using BrightSharp.Diagrams;
using BrightSharp.Themes;
using System;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;

namespace BrightSharp.Ui.Tests
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            SelectionBehavior.Attach(innerCanvas);
            //ThemeManager.Theme = ColorThemes.DarkBlue;
            tb.Text = ThemeManager.Theme.ToString();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (Enum.IsDefined(typeof(ColorThemes), ThemeManager.Theme + 1))
                ThemeManager.Theme = ThemeManager.Theme + 1;
            else
                ThemeManager.Theme = ColorThemes.Classic;
            tb.Text = ThemeManager.Theme.ToString();
        }

        private void Button_Click_ShowCustomWindow(object sender, RoutedEventArgs e)
        {
            new CustomWindow().ShowDialog();
        }

        private void Calendar_Loaded(object sender, RoutedEventArgs e)
        {
            var cal = (Calendar)sender;
            cal.BlackoutDates.Add(new CalendarDateRange(DateTime.Now.AddDays(-10), DateTime.Now.AddDays(-8)));
            cal.DisplayDateStart = DateTime.Now.AddDays(-400);
        }

        private void DataGrid_AutoGeneratedColumns(object sender, EventArgs e)
        {
            var dg = (DataGrid)sender;
            foreach (var col in dg.Columns)
            {
                col.Header = Regex.Replace(col.Header.ToString(), "([a-z])([A-Z])", "$1 $2");
            }
        }
        
    }
}
