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)
 {
     plugins.CherryEvents.Subscribe(new CherryEventListener(
                                        "Collect GUI Configurable Plugins",
                                        ea =>
     {
         var info = new GuiConfigurablePluginInfo(
             this.PluginName,
             new GeneralSettingsPanel(plugins),
             null);
         (ea as GuiConfigurablePluginEventArgs).GeneralSettingsInfo = info;
     }));
 }
        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(new CherryEventListener(
                                               "Collect GUI Configurable Plugins",
                                               ea =>
            {
                var info = new GuiConfigurablePluginInfo(
                    this.PluginName,
                    new LiveMessengerSettingsPanel(this),
                    Helpers.LoadIcon("res://live.ico"));
                (ea as GuiConfigurablePluginEventArgs).PluginInfos.Add(info);
            }));

            plugins.CherryEvents.Subscribe(
                "Application Started",
                () =>
            {
                if (this.Enabled)
                {
                    this.TryConnect();
                }
            });

            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)));

            plugins.CherryEvents.Subscribe(new CherryEventListener(
                                               "Pomodoro Minute Elapsed",
                                               cea =>
            {
                if (this.Enabled && this.IsConnected)
                {
                    SetMSNStatus(
                        true,
                        this.InPomodoroStatusCategory.ToString(),
                        string.Format(this.InPomodoroTextTemplate, (cea as PomodoroEventArgs).RunnigPomodoroData.MinutesLeft));
                }
            }));
        }
        public SettingsForm(
            PluginRepository plugins,
            GuiConfigurablePluginInfo generalSettingsInfo,
            IEnumerable <GuiConfigurablePluginInfo> guiPluginInfos)
        {
            this.plugins = plugins;
            InitializeComponent();

            var generalSettingsPanel = generalSettingsInfo.PluginSettingsPanel;
            var generalSettingsNode  = new TreeNode(generalSettingsInfo.PluginName)
            {
                Tag = generalSettingsPanel
            };

            settingsTreeView.Nodes.Add(generalSettingsNode);

            foreach (var plugin in guiPluginInfos)
            {
                var settingsNode = new TreeNode(plugin.PluginName)
                {
                    Tag = plugin.PluginSettingsPanel
                };

                if (plugin.PluginIcon != null)
                {
                    treeviewImages.Images.Add(plugin.PluginIcon);
                    settingsNode.ImageIndex         = treeviewImages.Images.Count - 1;
                    settingsNode.SelectedImageIndex = treeviewImages.Images.Count - 1;
                }

                generalSettingsNode.Nodes.Add(settingsNode);
            }

            settingsTreeView.SelectedNode = generalSettingsNode;
            generalSettingsNode.ExpandAll();
            panel.Controls.Add(generalSettingsPanel);

            CreateHandle();
        }
Beispiel #5
0
        public void TieEvents(PluginRepository plugins)
        {
            plugins.CherryEvents.Subscribe(new CherryEventListener(
                                               "Collect GUI Configurable Plugins",
                                               ea =>
            {
                var info = new GuiConfigurablePluginInfo(
                    this.PluginName,
                    new ProcessCloserSettingsPanel(this),
                    Helpers.LoadIcon("res://process.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)));

            plugins.CherryEvents.Subscribe("Pomodoro Started", this.StartPomodoroInternal);
        }
Beispiel #6
0
        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);
        }