using Data;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace OrgChartSamples
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class TemplateSample : Page
    {
        public TemplateSample()
        {
            this.InitializeComponent();
            CreateData();
        }

        void Button_Click(object sender, RoutedEventArgs e)
        {
            // create new data
            CreateData();
        }

        void CreateData()
        {
            var p = Person.CreatePerson(10);
            c1OrgChart1.Header = p;
        }

        private void comboOrientation_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (comboOrientation != null)
            {
                if (comboOrientation.SelectedIndex == 0)
                {
                    // horizontal
                    c1OrgChart1.Orientation = Orientation.Horizontal;
                }
                else
                {
                    c1OrgChart1.Orientation = Orientation.Vertical;
                }
            }
        }
    }
}
