public void TieEvents(PluginRepository plugins) { plugins.CherryEvents.Subscribe(new CherryEventListener( "Load Configuration Event", cpea => this.LoadConfiguration(cpea as ConfigureEventArgs))); plugins.CherryEvents.Subscribe(new CherryEventListener( "Save Configuration Event", cpea => this.SaveConfiguration(cpea as ConfigureEventArgs))); this.showBaloonCommand = plugins.CherryCommands["Show Balloon Tip", false]; plugins.CherryEvents.Subscribe(new CherryEventListener( "Application Started", ea => { if (!this.HasRun && this.showBaloonCommand != null) { this.showBaloonCommand.Do(new BaloonTipCommandArgs(new BaloonState { Caption = "I'm right here!", Message = "This icon represents cherrytomato. Right-click to start a pomodoro.", })); } }), false); }
public void TieEvents(PluginRepository plugins) { plugins.CherryEvents.Subscribe(new CherryEventListener( "Number of Pomodoro Changed", ea => this.SetPomodorosToday((ea as PomodoroEventArgs).ProductivityData))); plugins.CherryEvents.Subscribe("Icon Left Button Clicked", () => this.Enabled = !this.Enabled); plugins.CherryEvents.Subscribe(new CherryEventListener( "Connect To Database Event", ea => this.ConnectToDatabase((ea as ConnectToDbEventArgs).DbConnection))); plugins.CherryEvents.Subscribe(new CherryEventListener( "Collect GUI Configurable Plugins", ea => { var info = new GuiConfigurablePluginInfo( this.PluginName, new SimpleDashSettingsPanel(this), Helpers.LoadIcon("res://dashboard.ico")); (ea as GuiConfigurablePluginEventArgs).PluginInfos.Add(info); })); plugins.CherryEvents.Subscribe(new CherryEventListener( "Load Plugin Configuration Event", cpea => this.LoadConfiguration(cpea as ConfigurePluginEventArgs))); plugins.CherryEvents.Subscribe(new CherryEventListener( "Save Plugin Configuration Event", cpea => this.SaveConfiguration(cpea as ConfigurePluginEventArgs))); this.getCurrentPomodoroStatus = plugins.CherryCommands["Get Current Pomodoro Status Data"]; this.addNewTriggerCommand = plugins.CherryCommands["Add New Time Trigger"]; this.removeExistingTriggerCommand = plugins.CherryCommands["Remove Existing Time Trigger"]; this.getCurrentTime = plugins.CherryCommands["Get Current Time"]; }
public void TieEvents(PluginRepository plugins) { this.pluginRepository = plugins; this.removeReminderCommand = plugins.CherryCommands["Remove Existing Reminder"]; this.addNewReminderCommand = plugins.CherryCommands["Add New Reminder"]; this.editReminderCommand = plugins.CherryCommands["Edit Reminder"]; this.getAllRemindersCommand = plugins.CherryCommands["Get All Reminders"]; this.getAllReminderPluginsCommand = plugins.CherryCommands["Get All Reminder Plugins"]; }
public void AddCommand(ICherryCommand cc) { if (this.commands.ContainsKey(cc.Name)) { var message = string.Format("The command listener named '{0}' is already registered.", cc.Name); throw new PluginException(message); } this.commands[cc.Name] = cc; }
public void TieEvents(PluginRepository plugins) { this.pluginsRepository = plugins; this.showDialogCommand = plugins.CherryCommands["Show Window"]; plugins.CherryEvents.Subscribe( "Application Started", () => { this.reminderPlugins = plugins.CherryCommands["Get All Reminder Plugins"].Do(null) as ReminderPluginsRepository; }); }
public void TieEvents(PluginRepository plugins) { plugins.CherryEvents.Subscribe("Pomodoro Started", this.StartPomodoroInternal); plugins.CherryEvents.Subscribe(new CherryEventListener( "Pomodoro Finishing", ea => this.StopPomodoroInternal((ea as PomodoroEventArgs).PomodoroData.Successful))); plugins.CherryEvents.Subscribe("Application Started", this.renderer.Initialize); this.addNewTriggerCommand = plugins.CherryCommands["Add New Time Trigger"]; this.removeExistingTriggerCommand = plugins.CherryCommands["Remove Existing Time Trigger"]; }
public Reminder(PluginRepository plugins) { this.plugins = plugins; this.getCurrentTimeCommand = plugins.CherryCommands["Get Current Time"]; this.scheduleActionCommand = plugins.CherryCommands["Schedule Single Action"]; this.removeExistingTimeTriggerCommand = plugins.CherryCommands["Remove Existing Time Trigger"]; this.CompositeNotification = new CompositeNotification(plugins); this.CompositeCondition = new CompositeCondition(plugins); this.LastNotificationTime = this.Now; }
public void TieEvents(PluginRepository plugins) { now = plugins.CherryCommands["Get Current Time"]; this.lastPoll = this.Now; plugins.CherryEvents.Subscribe("Pomodoro Started", this.StartPomodoroInternal); plugins.CherryEvents.Subscribe(new CherryEventListener( "Pomodoro Finishing", ea => this.StopPomodoroInternal((ea as PomodoroEventArgs).PomodoroData))); this.addNewTriggerCommand = plugins.CherryCommands["Add New Time Trigger"]; this.removeExistingTriggerCommand = plugins.CherryCommands["Remove Existing Time Trigger"]; }
public void TieEvents(PluginRepository plugins) { this.showNoActivateCommand = plugins.CherryCommands["Show Window No Activate"]; plugins.CherryEvents.Subscribe(new CherryEventListener( "Pomodoro Finished", ea => { var pomodoro = (ea as PomodoroEventArgs).PomodoroData; if (pomodoro.Successful) { this.pomodoroEvaluationForm.SetData(pomodoro); this.showNoActivateCommand.Do(new WindowCommandArgs(this.pomodoroEvaluationForm)); } })); this.pomodoroEvaluationForm = new PomodoroEvaluationForm(plugins); }
/// <summary> /// Retrieves a command from the collection. /// </summary> /// <param name="commandName">The command name to search </param> /// <param name="throwException">Throw exception in case the command is absent?</param> /// <returns>The command object; or null it was not found.</returns> public ICherryCommand this[string commandName, bool throwException = true] { get { ICherryCommand rl = null; if (this.commands.TryGetValue(commandName, out rl)) { return(rl); } if (throwException) { throw new PluginException(string.Format("'{0}' command not found.", commandName)); } return(null); } }
public void TieEvents(PluginRepository plugins) { this.now = plugins.CherryCommands["Get Current Time"]; this.addNewTriggerCommand = plugins.CherryCommands["Add New Time Trigger"]; this.removeExistingTriggerCommand = plugins.CherryCommands["Remove Existing Time Trigger"]; this.scheduleActionCommand = plugins.CherryCommands["Schedule Single Action"]; this.removeExistingTimeTriggerCommand = plugins.CherryCommands["Remove Existing Time Trigger"]; plugins.CherryEvents.Subscribe(new CherryEventListener( "Load Configuration Event", cea => this.LoadConfig(cea as ConfigureEventArgs))); plugins.CherryEvents.Subscribe(new CherryEventListener( "Save Configuration Event", cea => this.SaveConfig(cea as ConfigureEventArgs))); plugins.CherryEvents.Subscribe(new CherryEventListener( "Connect To Database Event", ea => this.ConnectToDatabase((ea as ConnectToDbEventArgs).DbConnection))); }
public void TieEvents(PluginRepository plugins) { this.getAllReminderPluginsCommand = plugins.CherryCommands["Get All Reminder Plugins"]; plugins.CherryEvents.Subscribe(new CherryEventListener( "Load Configuration Event", cea => this.LoadConfig(cea as ConfigureEventArgs))); plugins.CherryEvents.Subscribe(new CherryEventListener( "Save Configuration Event", cea => this.SaveConfig(cea as ConfigureEventArgs))); plugins.CherryEvents.Subscribe(new CherryEventListener( "Collect GUI Configurable Plugins", ea => { var info = new GuiConfigurablePluginInfo( this.PluginName, plugins.CherryCommands["Get Reminders List Panel"].Do(null) as Control, Helpers.LoadIcon("res://reminders.ico")); (ea as GuiConfigurablePluginEventArgs).PluginInfos.Add(info); }), false); }
public void TieEvents(PluginRepository plugins) { this.getProductivityCommand = plugins.CherryCommands["Get Today Productivity"]; this.getCurrentPomodoroCommand = plugins.CherryCommands["Get Current Pomodoro Status Data"]; this.isInPomodoroCommand = plugins.CherryCommands["Is In Pomodoro"]; this.startPomodoroCommand = plugins.CherryCommands["Start Pomodoro"]; this.voidPomodoroCommand = plugins.CherryCommands["Void Pomodoro"]; this.addNewTriggerCommand = plugins.CherryCommands["Add New Time Trigger"]; this.removeExistingTriggerCommand = plugins.CherryCommands["Remove Existing Time Trigger"]; this.setActiveWindowForegroundCommand = plugins.CherryCommands["Set Active Window Foreground"]; this.showSettingsCommand = plugins.CherryCommands["Show Settings"]; plugins.CherryEvents.Subscribe("Pomodoro Started", this.StartPomodoroInternal); plugins.CherryEvents.Subscribe(new CherryEventListener( "Pomodoro Finished", ea => this.StopPomodoroInternal((ea as PomodoroEventArgs).PomodoroData.Successful))); plugins.CherryEvents.Subscribe(new CherryEventListener( "Active Window Changed", wea => { // Disable context menu when a window is shown. this.renderer.ContextMenuEnabled = (wea as WindowEventArgs).Window == null; })); plugins.CherryEvents.Subscribe(new CherryEventListener( "Application Started", ea => { this.renderer.CheckSystrayIconCreated(); }), false); // update minutes drawn on the pomodoro icon plugins.CherryEvents.Subscribe("Pomodoro Minute Elapsed", this.renderer.UpdateIconTime); }
public void TieEvents(PluginRepository plugins) { this.pluginRepository = plugins; this.scheduleActionCommand = plugins.CherryCommands["Schedule Single Action"]; this.getCurrentTimeCommand = plugins.CherryCommands["Get Current Time"]; plugins.CherryEvents.Subscribe("Pomodoro Finishing", () => this.Enabled = false); plugins.CherryEvents.Subscribe( "Application Started", () => { this.compositeNotification = new CompositeNotification( this.pluginRepository, new IconNotification { NotificationText = "Get back to work!", FlashCount = 15, FlashIconPath = "res://red.ico" }, new SoundNotification { SoundPath = @"pomo_reminder.wav" }); }); }
public override void TieEvents(PluginRepository plugins) { this.isInPomodoroCommand = plugins.CherryCommands["Is In Pomodoro"]; }
public override void TieEvents(PluginRepository plugins) { this.playSound = plugins.CherryCommands["Play Sound"]; }
public override void TieEvents(PluginRepository plugins) { this.showBaloonTip = plugins.CherryCommands["Show Balloon Tip"]; }
public override void TieEvents(PluginRepository plugins) { this.flashIcon = plugins.CherryCommands["Flash Icon"]; }
public override void TieEvents(PluginRepository plugins) { this.now = plugins.CherryCommands["Get Current Time"]; }
public override void TieEvents(PluginRepository plugins) { this.flashUsbLamp = plugins.CherryCommands["Flash Usb Lamp"]; }
public override void TieEvents(PluginRepository plugins) { this.getPomodoroStatus = plugins.CherryCommands["Get Current Pomodoro Status Data"]; }
public void TieEvents(PluginRepository plugins) { this.plugins = plugins; this.getAllConditionCheckerPluginsCommand = plugins.CherryCommands["Get All Condition Checker Plugins"]; }
public void TieEvents(PluginRepository plugins) { this.plugins = plugins; this.showWindowCommand = plugins.CherryCommands["Show Window"]; }
public void TieEvents(PluginRepository plugins) { plugins.CherryEvents.Subscribe("Pomodoro Started", this.StartPomodoroInternal); plugins.CherryEvents.Subscribe(new CherryEventListener( "Pomodoro Finishing", ea => this.StopPomodoroInternal((ea as PomodoroEventArgs).PomodoroData))); this.addNewTriggerCommand = plugins.CherryCommands["Add New Time Trigger"]; this.removeExistingTriggerCommand = plugins.CherryCommands["Remove Existing Time Trigger"]; plugins.CherryEvents.Subscribe(new CherryEventListener( "Load Plugin Configuration Event", cpea => this.LoadConfiguration(cpea as ConfigurePluginEventArgs))); plugins.CherryEvents.Subscribe(new CherryEventListener( "Save Plugin Configuration Event", cpea => this.SaveConfiguration(cpea as ConfigurePluginEventArgs))); }
public void TieEvents(PluginRepository plugins) { this.plugins = plugins; this.getAllNotifyPluginsCommand = plugins.CherryCommands["Get All Notify Plugins"]; }