/// <summary>
 /// check if the tasks already exists in task scheduler and get the data from them
 /// </summary>
 private void DoesTaskExists()
 {
     //user has custom hours enabled
     if (taskSchHandler.CheckExistingClass().Equals(1))
     {
         //ui
         autoCheckBox.IsChecked           = true;
         RadioButtonCustomTimes.IsChecked = true;
         //get times
         int[] darkStart  = taskSchHandler.GetRunTime("dark");
         int[] lightStart = taskSchHandler.GetRunTime("light");
         darkStartBox.Text = Convert.ToString(darkStart[0]);
         if (darkStart[1] < 10)
         {
             DarkStartMinutesBox.Text = "0" + Convert.ToString(darkStart[1]);
         }
         else
         {
             DarkStartMinutesBox.Text = Convert.ToString(darkStart[1]);
         }
         lightStartBox.Text = Convert.ToString(lightStart[0]);
         if (lightStart[1] < 10)
         {
             LightStartMinutesBox.Text = "0" + Convert.ToString(lightStart[1]);
         }
         else
         {
             LightStartMinutesBox.Text = Convert.ToString(lightStart[1]);
         }
     }
     //user has location sunset and sunrise enabled
     else if (taskSchHandler.CheckExistingClass().Equals(2))
     {
         autoCheckBox.IsChecked             = true;
         RadioButtonLocationTimes.IsChecked = true;
         ActivateLocationMode();
         InitOffset();
     }
     //user didn't enabled anything or tasks in scheduler are missing
     else
     {
         AutoCheckBox_Unchecked(this, null);
     }
 }
Ejemplo n.º 2
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;
         InitOffset();
     }
     else
     {
         AutoCheckBox_Unchecked(this, null);
     }
 }