public virtual void OnCheckboxChanged(bool lastDay) { DateTime beginTime, endTime; if (lastDay) { timer.Start(); beginTime = DateTime.Now.AddDays(-1); endTime = DateTime.Now; BeginYear.Text = beginTime.Year.ToString(); BeginYear.IsEnabled = false; BeginMonth.Text = beginTime.Month.ToString(); BeginMonth.IsEnabled = false; BeginDay.Text = beginTime.Day.ToString(); BeginDay.IsEnabled = false; BeginHour.Text = beginTime.Hour.ToString(); BeginHour.IsEnabled = false; BeginMinute.Text = beginTime.Minute.ToString(); BeginMinute.IsEnabled = false; EndYear.Text = endTime.Year.ToString(); EndYear.IsEnabled = false; EndMonth.Text = endTime.Month.ToString(); EndMonth.IsEnabled = false; EndDay.Text = endTime.Day.ToString(); EndDay.IsEnabled = false; EndHour.Text = endTime.Hour.ToString(); EndHour.IsEnabled = false; EndMinute.Text = endTime.Minute.ToString(); EndMinute.IsEnabled = false; CheckboxChanged?.Invoke(this, new ChangedEventArgs(lastDay, beginTime, endTime)); } else { timer.Stop(); BeginYear.IsEnabled = true; BeginMonth.IsEnabled = true; BeginDay.IsEnabled = true; BeginHour.IsEnabled = true; BeginMinute.IsEnabled = true; EndYear.IsEnabled = true; EndMonth.IsEnabled = true; EndDay.IsEnabled = true; EndHour.IsEnabled = true; EndMinute.IsEnabled = true; try { beginTime = new DateTime( Convert.ToInt32(BeginYear.Text), Convert.ToInt32(BeginMonth.Text), Convert.ToInt32(BeginDay.Text), Convert.ToInt32(BeginHour.Text), Convert.ToInt32(BeginMinute.Text), random.Next(60)); endTime = new DateTime( Convert.ToInt32(EndYear.Text), Convert.ToInt32(EndMonth.Text), Convert.ToInt32(EndDay.Text), Convert.ToInt32(EndHour.Text), Convert.ToInt32(EndMinute.Text), 0); CheckboxChanged?.Invoke(this, new ChangedEventArgs(lastDay, beginTime, endTime)); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } } }
private void CbxIsShowPassword_CheckedChanged(object sender, EventArgs e) { CheckboxChanged?.Invoke(sender, e); }
private void OnCheckboxChecked(object sender, RoutedEventArgs e) { CheckboxChanged?.Invoke(sender, e); }
private void CheckBoxChanged(object sender, EventArgs eventArgs) { CheckboxChanged?.Invoke(this, null); }
protected virtual void OnCheckBoxChanged(EventArgs e) { CheckboxChanged?.Invoke(this, e); }