string GetAttributeDisplayName(TimerStateEnum tse) { var type = typeof(TimerStateEnum); var memInfo = type.GetMember(tse.ToString()); var attributes = memInfo[0].GetCustomAttributes(typeof(DisplayAttribute), false); return(((DisplayAttribute)attributes.First()).Name); }
private void timer1_Tick(object sender, EventArgs e) { time = time.AddSeconds(-1); UpdateTimeLabel(); if (time.Minute == 0 && time.Second == 0) { TimerState = TimerStateEnum.Alarm; } }
public Form1() { InitializeComponent(); cycle = CycleEnum.Break; ToggleCycle(); TimerState = TimerStateEnum.Stop; alarmSound = new SoundPlayer(_25work.Properties.Resources.alarm); alarmSound.Load(); UpdateWorkTimeLabel(); }
private void cancelButton_Click(object sender, EventArgs e) { switch (((Button)sender).Text) { case "Stop": TimerState = TimerStateEnum.Stop; break; case "Toggle Cycle": ToggleCycle(); break; } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { TimerStateEnum timerState = (TimerStateEnum)value; if (timerState == TimerStateEnum.Running) { return("॥"); } else if (timerState == TimerStateEnum.Stopped) { return("►"); } else { return("►"); } }
private void button1_Click(object sender, EventArgs e) { switch (((Button)sender).Text) { case "Start": TimerState = TimerStateEnum.Start; break; case "Pause": TimerState = TimerStateEnum.Pause; break; case "Continue": TimerState = TimerStateEnum.Continue; break; case "Dismiss": TimerState = TimerStateEnum.Dismiss; TimerState = TimerStateEnum.Start; break; } }