using System;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml.Controls;

namespace ControlExplorer.Controls.Calendar
{
    /// <summary>
    /// Shows the C1Calendar control with default appearance options and some bolded dates.
    /// </summary>
    public partial class CalendarDemo : UserControl
    {
        public CalendarDemo()
        {
            InitializeComponent();
            // add some bolded days
            cal1.BoldedDates.Add(DateTime.Today.AddDays(2));
            cal1.BoldedDates.Add(DateTime.Today.AddDays(12));
            cal1.BoldedDates.Add(DateTime.Today.AddDays(22));
            cal1.BoldedDates.Add(DateTime.Today.AddDays(-2));
            cal1.BoldedDates.Add(DateTime.Today.AddDays(-12));
            cal1.BoldedDates.Add(DateTime.Today.AddDays(-22));

            CalendarDemo_SizeChanged(this, null);
            SizeChanged += CalendarDemo_SizeChanged;
        }

        void CalendarDemo_SizeChanged(object sender, Windows.UI.Xaml.SizeChangedEventArgs e)
        {
            // only show week numbers in landscape orientation
            var orientation = ApplicationView.GetForCurrentView().Orientation;
            cal1.ShowWeekNumbers = orientation == ApplicationViewOrientation.Landscape; 
        }
    }
}
