コード例 #1
0
        private void CreateTimerRow(string name, TimeSpan timeSpan)
        {
            TimerRow newRow = new TimerRow(name, timeSpan);

            newRow.TimerRowElapsed += TimerRowElapsed;
            TimerRows.Add(newRow);
        }
コード例 #2
0
        private void DeleteTimerRowButton_Click(object sender, RoutedEventArgs e)
        {
            TimerRow timerRow = (sender as FrameworkElement).DataContext as TimerRow;

            timerRow.TimerRowElapsed -= TimerRowElapsed;
            timerRow.StopTimer();
            TimerRows.Remove(timerRow);
        }
コード例 #3
0
        private void TimerRowElapsed(object sender)
        {
            TimerRow timerRow = sender as TimerRow;

            ShowTimerElapsedNotification(timerRow);
            _lastNotifiedTimerRow = timerRow;
            _persistNotification  = true;
        }
コード例 #4
0
        private TimerRow ConstructRow()
        {
            RadioButton oneTime = new RadioButton();
            RadioButton repeat  = new RadioButton();

            List <RadioButton> disableGroup        = new List <RadioButton>();
            RadioButton        specificTimeButton  = ConfigureTimeButton("At specific time", disableGroup);
            RadioButton        everySomeTimeButton = ConfigureTimeButton("Notify every..", disableGroup);
            RadioButton        notifyAfterButton   = ConfigureTimeButton("Notify after", disableGroup);

            disableGroup.AddRange(new List <RadioButton> {
                specificTimeButton, everySomeTimeButton, notifyAfterButton
            });

            TextBox timeBox = new TextBox();

            timeBox.Width     = 70;
            timeBox.Height    = 25;
            timeBox.FontSize  = 12;
            timeBox.Text      = "00:00:00";
            timeBox.MaxLength = 8;

            List <RadioButton> oneTimeButtons = new List <RadioButton> {
                specificTimeButton, notifyAfterButton
            };
            List <RadioButton> repeatButtons = new List <RadioButton> {
            };

            TextBox titleBox = new TextBox();

            titleBox.Margin    = new Thickness(5);
            titleBox.Width     = 200;
            titleBox.Height    = 25;
            titleBox.FontSize  = 12;
            titleBox.MaxLength = 75;

            StackPanel choicePanel = new StackPanel();

            choicePanel.Margin = new Thickness(5);
            choicePanel.Children.Add(oneTime);
            choicePanel.Children.Add(repeat);

            StackPanel timePanel = new StackPanel();

            timePanel.Margin = new Thickness(5);
            ConfigureRadioButton(oneTime, repeat, "One time", oneTimeButtons, timePanel);
            ConfigureRadioButton(repeat, oneTime, "Repeat", repeatButtons, timePanel);

            TimerRow row = new TimerRow(oneTime, timePanel, timeBox, titleBox);

            row.Children.Add(choicePanel);
            row.Children.Add(timePanel);
            row.Children.Add(timeBox);
            row.Children.Add(titleBox);
            return(row);
        }
コード例 #5
0
        private void FillCollection()
        {
            TimerRow tmp = new TimerRow("Wstęp", 25, "Przykładowa", true, false);

            ds.TimesCollection.Add(tmp);
            tmp = new TimerRow("Rozwinięcie", 120, "Lista");
            ds.TimesCollection.Add(tmp);
            tmp = new TimerRow("Zakończenie", 30, "pa Czasów", false);
            ds.TimesCollection.Add(tmp);
            OnPropertyChanged(() => Ds.TimesCollection);
        }
コード例 #6
0
 public AddBaseTimerViewModel(DataSet ds, TimerRow bt = null)
 {
     this.ds = ds;
     newBt   = bt;
     if (bt != null)
     {
         var t = new TimeSpan(0, 0, (int)bt.Duration);
         DurationHours   = t.Hours;
         DurationMinutes = t.Minutes;
         DurationSeconds = t.Seconds;
     }
 }
コード例 #7
0
        private Button ConfigureRemoveButton(TimerRow toRemove, Panel from)
        {
            Button b = new Button();

            b.Content  = "X";
            b.FontSize = 13;
            b.Width    = double.NaN;
            b.Height   = 20;
            b.Click   += (o, e) =>
            {
                from.Children.Remove(toRemove);
            };
            return(b);
        }
コード例 #8
0
        private void StartButton_Click(object sender, RoutedEventArgs e)
        {
            TimerRow timerRow = (sender as FrameworkElement).DataContext as TimerRow;

            timerRow.ToggleTimer();
        }
コード例 #9
0
 private void ShowTimerElapsedNotification(TimerRow timerRow)
 {
     taskBarIcon.ShowBalloonTip("Time is up!", string.Format("Timer \"{0}\" is finished. Click to dismiss", timerRow.Name), BalloonIcon.Info);
 }