/// <summary> /// Set the solid colour based on the timer status. /// </summary> /// <param name="e"></param> private void UpdateTimerStatusColor(TimerModelEventArgs e) { if (_settings.Colours == false) { StatusColor = Colors.Transparent; return; } switch (e.State) { case TimerModelEventArgs.Status.NotSpecified: StatusColor = Colors.Beige; break; case TimerModelEventArgs.Status.Stopped: StatusColor = Colors.Beige; break; case TimerModelEventArgs.Status.Started: StatusColor = Colors.LightSalmon; break; case TimerModelEventArgs.Status.Running: StatusColor = Colors.LightSalmon; break; case TimerModelEventArgs.Status.Completed: StatusColor = Colors.LightGreen; break; case TimerModelEventArgs.Status.Reset: StatusColor = Colors.Beige; break; } }
/// <summary> /// Fires when the timer stops. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnStopped(object sender, TimerModelEventArgs e) { UpdateTimer(e); Messenger.Default.Send(new TaskbarItemMessage { State = TaskbarItemProgressState.Paused }); }
private void UpdateTimer(TimerModelEventArgs e) { TimeSpan t = _timer.Remaining; TimerValue = string.Format("{0}:{1}:{2}", t.Hours.ToString("D2"), t.Minutes.ToString("D2"), t.Seconds.ToString("D2")); PercentElapsed = 100.0 - (100.0 * _timer.Remaining.TotalSeconds / _timer.Duration.TotalSeconds); }
private void OnStopped(object sender, TimerModelEventArgs e) { UpdateTimer(e); eventAggregator.GetEvent <GI_ItemMessageEvent>().Publish(new GIItemMessage { State = e.State.ToString() }); }
/// <summary> /// Fires when the timer ticks. Ticks out to be of the order of /// tenths of a second or so to prevent excessive spamming of this method. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnTick(object sender, TimerModelEventArgs e) { UpdateTimer(e); Messenger.Default.Send(new TaskbarItemMessage { State = TaskbarItemProgressState.Normal, Value = PercentElapsed / 100.0 }); Messenger.Default.Send(new SimpleMessage(SimpleMessage.MessageType.TimerTick, TimerValue)); }
private void OnCompleted(object sender, TimerModelEventArgs e) { UpdateTimer(e); eventAggregator.GetEvent <GI_ItemMessageEvent>().Publish(new GIItemMessage { State = e.State.ToString(), PercentageValue = 100 }); }
private void OnReset(object sender, TimerModelEventArgs e) { UpdateTimer(e); eventAggregator.GetEvent <FCU_ItemMessageEvent>().Publish(new FCUItemMessage { State = e.State.ToString(), PercentageValue = 0 }); }
/// <summary> /// Fires when the timer resets. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnReset(object sender, TimerModelEventArgs e) { var timer = sender as TimerModel; UpdateTimer(e); Messenger.Default.Send(new TaskbarItemMessage { State = TaskbarItemProgressState.None, Value = 0.0 }); Messenger.Default.Send(new SimpleMessage(SimpleMessage.MessageType.TimerReset)); }
private void OnTick(object sender, TimerModelEventArgs e) { UpdateTimer(e); eventAggregator.GetEvent <GI_ItemMessageEvent>().Publish(new GIItemMessage { State = e.State.ToString(), PercentageValue = PercentElapsed, TimerValue = TimerValue }); }
/// <summary> /// Fires when the timer starts. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void OnStarted(object sender, TimerModelEventArgs e) { UpdateTimer(e); if (_settings.PlayBeep) { SystemSounds.Beep.Play(); } Messenger.Default.Send(new TaskbarItemMessage { State = TaskbarItemProgressState.Normal }); }
/// <summary> /// Fires where the timer completes. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnCompleted(object sender, TimerModelEventArgs e) { UpdateTimer(e); CompletedCount++; if (_settings.PlayExclamation) { SystemSounds.Exclamation.Play(); } Messenger.Default.Send(new TaskbarItemMessage { State = TaskbarItemProgressState.Normal, Value = 1.0 }); }
/// <summary> /// Update the timer view model properties based on the time span passed in. /// </summary> /// <param name="t"></param> private void UpdateTimer(TimerModelEventArgs e) { UpdateTimerValues(); UpdateTimerStatusColor(e); }
private void OnStarted(object sender, TimerModelEventArgs e) { UpdateTimer(e); }