コード例 #1
0
        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();
        }
 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;
         }));
 }
コード例 #3
0
        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"];
        }
コード例 #4
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);
        }
コード例 #5
0
        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 SkypeSettingsPanel(this),
                        Helpers.LoadIcon("res://skype.ico"));
                    (ea as GuiConfigurablePluginEventArgs).PluginInfos.Add(info);
                }));

            plugins.CherryEvents.Subscribe("Application Started", this.Initialize);

            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)
                    {
                        this.StatusText = string.Format(
                            this.InPomodoroTextTemplate,
                            (cea as PomodoroEventArgs).RunnigPomodoroData.MinutesLeft);
                    }
                }));
        }
コード例 #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);
        }