Exemplo n.º 1
0
 private void button3_Click(object sender, RoutedEventArgs e)
 {
     DateTime newSystemTime = getCurrentTimeFromInternet();
     newSystemTime.AddMilliseconds(0.0);
     DateTime time3 = GetLastTimeStamp("Sleep_Time_M").AddDays(1.0);
     SystemTimeUpdate update = new SystemTimeUpdate(newSystemTime);
     BusyTimeLine NextActivity = MySchedule.NextActivity;
     DateTime now = DateTime.Now;
     if (NextActivity != null)
     {
         textBlock2.Text = "Next Activity is : " + MySchedule.getCalendarEvent(NextActivity.TimeLineID).Name;
         FinalDate = NextActivity.Start;
         now = new DateTime(now.Ticks - (now.Ticks % 0x989680L), now.Kind);
         FinalDate = new DateTime(FinalDate.Ticks - (FinalDate.Ticks % 0x989680L), FinalDate.Kind);
         TimeTo24HourLeft = (TimeSpan)(FinalDate - now);
         DispatcherTimer timer = new DispatcherTimer
         {
             Interval = new TimeSpan(0, 0, 1)
         };
         timer.Tick += new EventHandler(OnTimedEvent);
         timer.Start();
         CountDownTimer();
         return;
     }
     textBlock2.Text = "Next Activity is : Time To Next 24 Hour Count Down";
     FinalDate = time3;
     now = new DateTime(now.Ticks - (now.Ticks % 0x989680L), now.Kind);
     FinalDate = new DateTime(FinalDate.Ticks - (FinalDate.Ticks % 0x989680L), FinalDate.Kind);
     TimeTo24HourLeft = (TimeSpan)(FinalDate - now);
     DispatcherTimer timer2 = new DispatcherTimer
     {
         Interval = new TimeSpan(0, 0, 1)
     };
     timer2.Tick += new EventHandler(OnTimedEvent);
     timer2.Start();
     CountDownTimer();
 }
Exemplo n.º 2
0
 private void button4_Click(object sender, RoutedEventArgs e)
 {
     DateTime newSystemTime = getCurrentTimeFromInternet();
     newSystemTime.AddMilliseconds(0.0);
     TimeSpan span = GetTotalSleepIn24Difference();
     textBlock1.Text = string.Concat(new object[] { span.Days, ":", span.Hours, ":", span.Minutes, ":", span.Seconds });
     SystemTimeUpdate update = new SystemTimeUpdate(newSystemTime);
     string currentTextOfFile = GetCurrentTextOfFile(@"..\WriteLines.txt");
     string[] strArray = currentTextOfFile.Split(new char[] { '\n' });
     File.WriteAllText(@"..\WriteLines.txt", currentTextOfFile + string.Concat(new object[] { "Log_Check|", newSystemTime.Year, " ", newSystemTime.Month, " ", newSystemTime.Day, "|", newSystemTime.Hour, " ", newSystemTime.Minute, " ", newSystemTime.Second, "\n" }));
 }
Exemplo n.º 3
0
 private void button2_Click(object sender, RoutedEventArgs e)
 {
     DateTime newSystemTime = getCurrentTimeFromInternet();
     newSystemTime.AddMilliseconds(0.0);
     textBlock1.Text = newSystemTime.ToString();
     SystemTimeUpdate update = new SystemTimeUpdate(newSystemTime);
     File.WriteAllText(@"..\WriteLines.txt", GetCurrentTextOfFile(@"..\WriteLines.txt") + string.Concat(new object[] { "Wake_Time|", newSystemTime.Year, " ", newSystemTime.Month, " ", newSystemTime.Day, "|", newSystemTime.Hour, " ", newSystemTime.Minute, " ", newSystemTime.Second, "\n" }));
 }