示例#1
0
 private void workClock()
 {
     while (true)
     {
         objectClassClock.Hour   = (byte)DateTime.Now.Hour;
         objectClassClock.Minute = (byte)DateTime.Now.Minute;
         objectClassClock.Second = (byte)DateTime.Now.Second;
         actualT.Clear();
         actualT.Append(ClassSettings.FormatDisplay(objectClassClock.Hour)).Append(":").Append(ClassSettings.FormatDisplay(objectClassClock.Minute))
         .Append(":").Append(ClassSettings.FormatDisplay(objectClassClock.Second));
         Dispatcher.Invoke(() =>
         {
             actualTime.Text = actualT.ToString();
             if (textToggleSwitchState.Text.Equals("On"))
             {
                 objectClassSettings.OnAlarmSong(hour: objectClassClock.Hour, minute: objectClassClock.Minute);
             }
         });
         Thread.Sleep(1000);
     }
 }
示例#2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            byte i = 0;

            for (; i < 24; i++)
            {
                setHours.Items.Add(ClassSettings.FormatDisplay(i)); //new ComboBoxItem() { FontSize = 12, Content = i.ToString() }
                setMinutes.Items.Add(ClassSettings.FormatDisplay(i));
            }
            for (; i < 60; i++)
            {
                setMinutes.Items.Add(i.ToString());
            }
            actualT          = new StringBuilder();
            objectClassClock = new ClassClock();
            objectClassClock.AddActionClock(workClock);
            objectClassClock.StartClock();
            objectClassSettings        = new ClassSettings();
            gridSettings.DataContext   = gridMainWindow.DataContext = objectClassSettings;
            listAlarmCLock.ItemsSource = objectClassSettings.GetListAlarmClock;
            objectClassTraySystem      = new ClassTrySystem(this);
            setToolTipToButtonToggleSwitch();
            setSaveSettings();
        }