using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
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 User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236

namespace BoxOfficeDashboard.Views
{
    public sealed partial class DashboardView : UserControl
    {
        public DashboardView()
        {
            this.InitializeComponent();
        }

        private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            if(e.NewSize.Height > e.NewSize.Width)
            {
                Grid.SetColumnSpan(totalChart, 2);
                Grid.SetRowSpan(totalChart, 1);
                Grid.SetColumn(marketShareChart, 0);
                Grid.SetRow(marketShareChart, 1);
                Grid.SetColumnSpan(marketShareChart, 2);
                overallGrossGauge.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }
            else
            {
                Grid.SetColumnSpan(totalChart, 1);
                Grid.SetRowSpan(totalChart, 2);
                Grid.SetColumn(marketShareChart, 1);
                Grid.SetRow(marketShareChart, 0);
                Grid.SetColumnSpan(marketShareChart, 1);
                overallGrossGauge.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }
        }
    }
}
