示例#1
0
        public PluginManager(Dictionary <string, MethodInfo> plugins)
        {
            InitializeComponent();
            Plugins = plugins;

            foreach (var plugin in plugins)
            {
                ListOfPlugins.Items.Add(plugin.Key);
            }

            _pluginsLoader = ContainerForUnity.MainContainer.Resolve <IPluginsLoader>();
            _changesInfo   = new ChangesInfo();
        }
示例#2
0
        private void BindPluginsMenuItem(ChangesInfo changes)
        {
            foreach (var plugin in changes.Removed)
            {
                pluginsMenuItem.DropDownItems.RemoveByKey(plugin);
            }

            foreach (var plugin in changes.Added)
            {
                pluginsMenuItem.DropDownItems.Add(new ToolStripMenuItem(plugin)
                {
                    Name = plugin
                });
                pluginsMenuItem.DropDownItems[plugin].Click += (s, e) =>
                {
                    _notepadPresenter.ExecutePluginWork(plugin);
                };
            }
        }