private void CreateTimerRow(string name, TimeSpan timeSpan) { TimerRow newRow = new TimerRow(name, timeSpan); newRow.TimerRowElapsed += TimerRowElapsed; TimerRows.Add(newRow); }
private void DeleteTimerRowButton_Click(object sender, RoutedEventArgs e) { TimerRow timerRow = (sender as FrameworkElement).DataContext as TimerRow; timerRow.TimerRowElapsed -= TimerRowElapsed; timerRow.StopTimer(); TimerRows.Remove(timerRow); }
private void TimerRowElapsed(object sender) { TimerRow timerRow = sender as TimerRow; ShowTimerElapsedNotification(timerRow); _lastNotifiedTimerRow = timerRow; _persistNotification = true; }
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); }
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); }
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; } }
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); }
private void StartButton_Click(object sender, RoutedEventArgs e) { TimerRow timerRow = (sender as FrameworkElement).DataContext as TimerRow; timerRow.ToggleTimer(); }
private void ShowTimerElapsedNotification(TimerRow timerRow) { taskBarIcon.ShowBalloonTip("Time is up!", string.Format("Timer \"{0}\" is finished. Click to dismiss", timerRow.Name), BalloonIcon.Info); }