Esempio n. 1
0
        public MainWindow()
        {
            InitializeComponent();
            updater.CheckNewVersion();

            //check if task already exists
            if (taskShedHandler.CheckExistingClass() != null)
            {
                autoRadio.IsChecked = true;
                darkStartBox.Text   = Convert.ToString(taskShedHandler.GetRunTime("dark"));
                lightStartBox.Text  = Convert.ToString(taskShedHandler.GetRunTime("light"));
                UiHandler();
            }
            else
            {
                //check which value the registry key has
                if (RegEditHandler.AppsUseLightTheme() == true)
                {
                    lightRadio.IsChecked = true;
                }
                else if (RegEditHandler.AppsUseLightTheme() == false)
                {
                    darkRadio.IsChecked = true;
                }
                UiHandler();
            }
        }
        public void SwitchThemeBasedOnTime()
        {
            TaskShedHandler task       = new TaskShedHandler();
            var             hour       = DateTime.Now.Hour;
            var             minute     = DateTime.Now.Minute;
            var             lightStart = task.GetRunTime("light");
            var             darkStart  = task.GetRunTime("dark");

            if (hour < lightStart[0] || hour >= darkStart[0])
            {
                if (hour == darkStart[0])
                {
                    if (minute < darkStart[1])
                    {
                        ThemeToLight();
                        //Console.WriteLine("Theme to Light");
                    }
                    if (minute >= darkStart[1])
                    {
                        ThemeToDark();
                        //Console.WriteLine("Theme to Dark");
                    }
                }
                else
                {
                    ThemeToDark();
                    //Console.WriteLine("Theme to Dark");
                }
            }
            else if (hour >= lightStart[0] || hour < darkStart[0])
            {
                if (hour == lightStart[0])
                {
                    if (minute < lightStart[1])
                    {
                        ThemeToDark();
                        //Console.WriteLine("Theme to Dark");
                    }
                    if (minute >= lightStart[1])
                    {
                        ThemeToLight();
                        //Console.WriteLine("Theme to Light");
                    }
                }
                else
                {
                    ThemeToLight();
                    //Console.WriteLine("Theme to Light");
                }
            }
        }
        public void SwitchThemeBasedOnTime()
        {
            TaskShedHandler task       = new TaskShedHandler();
            var             time       = DateTime.Now.Hour;
            var             lightStart = task.GetRunTime("light");
            var             darkStart  = task.GetRunTime("dark");


            if (time < lightStart || time >= darkStart)
            {
                ThemeToDark(); MainWindow.ThemeSettingDark = true;
            }
            else if (time >= lightStart || time < darkStart)
            {
                ThemeToLight(); MainWindow.ThemeSettingDark = false;
            }
        }
Esempio n. 4
0
 private void DoesTaskExists()
 {
     if (taskShedHandler.CheckExistingClass().Equals(1))
     {
         autoCheckBox.IsChecked = true;
         int[] darkStart  = taskShedHandler.GetRunTime("dark");
         int[] lightStart = taskShedHandler.GetRunTime("light");
         darkStartBox.Text         = Convert.ToString(darkStart[0]);
         DarkStartMinutesBox.Text  = Convert.ToString(darkStart[1]);
         lightStartBox.Text        = Convert.ToString(lightStart[0]);
         LightStartMinutesBox.Text = Convert.ToString(lightStart[1]);
     }
     else if (taskShedHandler.CheckExistingClass().Equals(2))
     {
         autoCheckBox.IsChecked     = true;
         locationCheckBox.IsChecked = true;
     }
     else
     {
         AutoCheckBox_Unchecked(this, null);
     }
 }