public void StopPomodoroInternal(bool completed) { if (completed) // Finished pomodoro { var flashingData = new FlashingState { FlashesCount = 20, ToolTipMessage = "Pomodoro completed", FirstIcon = IconType.Idle, SecondIcon = IconType.Pomodoro }; this.StartFlashing(flashingData); } else { this.renderer.SetIconType(IconType.Idle); } this.renderer.ContextMenuStrip.UpdateControl(delegate { if (this.startOrVoidPomodoroIconMenuItem != null) { this.startOrVoidPomodoroIconMenuItem.Text = StartPomodoroMenuText; } if (this.settingsIconMenuItem != null) { this.settingsIconMenuItem.Enabled = true; } }); }
public bool StartFlashing(FlashingState flashingData) { if ((flashingData.FirstIcon == IconType.Special && flashingData.FirstSpecialIcon == null) || (flashingData.SecondIcon == IconType.Special && flashingData.SecondSpecialIcon == null)) { throw new PluginException("Please provide icon when trying to flash with a special icon."); } if (this.IsFlashing) { // Is any other flashing is going at the moment, then stop it and start new flashing. this.StopFlashing(); } this.IsFlashing = true; this.controller.renderer.ToolTipText = flashingData.ToolTipMessage; int counter = flashingData.FlashesCount * 2; this.controller.addNewTriggerCommand.Do(new TimeTriggerCommandArgs( "Quarter Second Elapsed for Icon Controller", // fired on every 250 milliseconds new SimpleTrigger( "Quarter Second Elapsed for Icon Controller", counter, TimeSpan.FromMilliseconds(250)), () => { counter--; if (counter % 2 == 0) { this.controller.renderer.SetIconType(flashingData.FirstIcon, flashingData.FirstSpecialIcon); } else { this.controller.renderer.SetIconType(flashingData.SecondIcon, flashingData.SecondSpecialIcon); } if (counter <= 0) { this.StopFlashing(); } })); return(true); }
public bool StartFlashing(FlashingState flashingData) { if ((flashingData.FirstIcon == IconType.Special && flashingData.FirstSpecialIcon == null) || (flashingData.SecondIcon == IconType.Special && flashingData.SecondSpecialIcon == null)) { throw new PluginException("Please provide icon when trying to flash with a special icon."); } if (this.IsFlashing) { // Is any other flashing is going at the moment, then stop it and start new flashing. this.StopFlashing(); } this.IsFlashing = true; this.controller.renderer.ToolTipText = flashingData.ToolTipMessage; int counter = flashingData.FlashesCount * 2; this.controller.addNewTriggerCommand.Do(new TimeTriggerCommandArgs( "Quarter Second Elapsed for Icon Controller", // fired on every 250 milliseconds new SimpleTrigger( "Quarter Second Elapsed for Icon Controller", counter, TimeSpan.FromMilliseconds(250)), () => { counter--; if (counter % 2 == 0) { this.controller.renderer.SetIconType(flashingData.FirstIcon, flashingData.FirstSpecialIcon); } else { this.controller.renderer.SetIconType(flashingData.SecondIcon, flashingData.SecondSpecialIcon); } if (counter <= 0) { this.StopFlashing(); } })); return true; }
private bool StartFlashing(FlashingState flashingData) { return this.flasher.StartFlashing(flashingData); }
public FlashIconCommandArgs(FlashingState flashingSettings) { this.FlashingSettings = flashingSettings; }
private bool StartFlashing(FlashingState flashingData) { return(this.flasher.StartFlashing(flashingData)); }