/// <summary> /// 加载当前主程序插件。 /// </summary> /// <param name="cfgs"></param> public void Load(PluginCfgs cfgs) { if (cfgs != null && cfgs.Count > 0) { foreach (PluginCfg cfg in cfgs) { this.LoadPlugin(cfg); } if (this.host != null) { this.bootstrapPlugins.Deploy(this.host); Form f = this.host as Form; if (f != null && this.pluginHotKeys.Count > 0) { this.hotkeysFilter = new HotkeysFilter(f.Handle); f.FormClosing += new FormClosingEventHandler(delegate(object sender, FormClosingEventArgs e) { this.hotkeysFilter.UnregisterHotKey(); }); string[] hotKeys = new string[this.pluginHotKeys.Keys.Count]; this.pluginHotKeys.Keys.CopyTo(hotKeys, 0); this.hotkeysFilter.RegisterHotkey(hotKeys); this.hotkeysFilter.Hotkey += new HotkeyEventHandler(delegate(string hotKey) { IPlugin p = this.pluginHotKeys[hotKey] as IPlugin; if (p != null && p.Window != null) { IHotkeys hot = p.Window as IHotkeys; if (hot != null) { hot.ProcessHotkey(hotKey); } } }); } } } }
/// <summary> /// 构造函数。 /// </summary> public PluginsConfiguration() { this.pluginCfgs = new PluginCfgs(); }