public FormMain() { //InitializeComponent(); //CheckForIllegalCrossThreadCalls = false; //目录初始化 if (!Directory.Exists(AppEnvironment.AppBinPath)) { Directory.CreateDirectory(AppEnvironment.AppBinPath); } if (!Directory.Exists(AppEnvironment.AppPluginPath)) { Directory.CreateDirectory(AppEnvironment.AppPluginPath); } if (!Directory.Exists(AppEnvironment.AppPluginConfigPath)) { Directory.CreateDirectory(AppEnvironment.AppPluginConfigPath); } if (!Directory.Exists(AppEnvironment.AppLanguagePath)) { Directory.CreateDirectory(AppEnvironment.AppLanguagePath); } //----数据初始化---- InitUi.InitCustomShellType(AppEnvironment.AppCustomShellTypePath); InitUi.InitGlobalSetting(AppEnvironment.AppPath); var basicSetting = (GlobalSetting.Setting as Setting).BasicSetting; //----数据初始化结束---- //语言初始化 var lang = basicSetting.Language; AltLangRes.ReadLanguageResource(lang); AltStrRes.SetTranslatedStrings(AltLangRes.Table); //----导入插件---- //_pluginsImport = new PluginsImport(); _host = new Host(this); PluginProvider.Host = _host; PluginProvider.Compose(AppEnvironment.AppPluginPath, AppEnvironment.AppServicePath, basicSetting.IsOpenIPythonSupport); //UI处理 Init(); LoadPluginsInUi(); InitPlugins(PluginProvider.Plugins); //----导入插件结束---- //显示免责声明 InitUi.InitWelcome(); //auto call services AutoLoadServices(PluginProvider.Services); LoadServicesInUi(); //auto load plugins AutoLoadPlugins(PluginProvider.Plugins); }
public FormMain() { InitializeComponent(); //CheckForIllegalCrossThreadCalls = false; //目录初始化 if (!Directory.Exists("Bin")) { Directory.CreateDirectory("Bin"); } if (!Directory.Exists("Plugins")) { Directory.CreateDirectory("Plugins"); } if (!Directory.Exists("Plugins/Config")) { Directory.CreateDirectory("Plugins/Config"); } if (!Directory.Exists("Languages")) { Directory.CreateDirectory("Languages"); } //----导入插件---- _pluginsImport = new PluginsImport(); _host = new Host(this); Compose(); //----导入插件结束---- //----数据初始化---- InitUi.InitCustomShellType(); InitUi.InitGlobalSetting(); //----数据初始化结束---- //----UI处理---- //tabControl事件绑定 tabControl1.DoubleClick += tabControl1_DoubleClick; //设置版本号 toolStripStatusLabel_productVersion.Text = string.Format("Version:{0}@KeePwn", Assembly.GetExecutingAssembly().GetName().Version); //tabControl初始化 TabCore.Init(this, this.tabControl1); //treenode TreeNode treeNodeRoot1; treeNodeRoot1 = InitUi.GetCustomShellTypeTree(); treeNodeRoot1.Name = "ShellType"; treeNodeRoot1.Text = "ShellType"; this.treeView_func.Nodes.AddRange(new TreeNode[] { treeNodeRoot1 }); //plugins LoadPluginsInUi(_pluginsImport.Plugins.OrderBy(p => p.PluginSetting.IndexInList).ThenBy(p => p.PluginInfo.Name)); //----UI处理结束---- //显示免责声明 InitUi.InitWelcome(); //auto load plugins AutoLoadPlugins(_pluginsImport.Plugins); }
public FormMain() { InitializeComponent(); //CheckForIllegalCrossThreadCalls = false; //目录初始化 if (!Directory.Exists("Bin")) { Directory.CreateDirectory("Bin"); } if (!Directory.Exists("Plugins")) { Directory.CreateDirectory("Plugins"); } if (!Directory.Exists("Plugins/Config")) { Directory.CreateDirectory("Plugins/Config"); } if (!Directory.Exists("Languages")) { Directory.CreateDirectory("Languages"); } /*使用MEF导入插件 * MEF的使用步骤: * 1.导出标指定对象[Export]; * 2.在宿主代码中设定[Import]; * 3.组合部件(主要是将宿主中Import和导出Export对象进行引用链接); * 4.使用导入的对象。*/ //----导入插件---- _pluginsImport = new PluginsImport(); _host = new Host(this);//该接口类实例将作为参数传递给MEF导入类的构造函数,方便导入对象使用 Compose(); //----导入插件结束---- //----数据初始化---- InitUi.InitCustomShellType(); //读取指定目录的CustomShellType文件内容到程序中,并进行相关设置 InitUi.InitGlobalSetting(); //读取指定目录的Setting文件内容到程序中,并进行相关设置 //----数据初始化结束---- //----UI处理---- //tabControl事件绑定 tabControl1.DoubleClick += tabControl1_DoubleClick;//添加双击Tab选项卡标题则关闭选项卡的事件处理函数 //设置版本号 toolStripStatusLabel_productVersion.Text = string.Format("Version:{0}@KeePwn", Assembly.GetExecutingAssembly().GetName().Version); //tabControl初始化 TabCore.Init(this, this.tabControl1);//TabCore类的作用主要是在TabControl中添加新的TabPage //treenode TreeNode treeNodeRoot1; treeNodeRoot1 = InitUi.GetCustomShellTypeTree(); treeNodeRoot1.Name = "ShellType"; treeNodeRoot1.Text = "ShellType"; this.treeView_func.Nodes.AddRange(new TreeNode[] { treeNodeRoot1 }); //加载Plugins菜单项 LoadPluginsInUi(_pluginsImport.Plugins.OrderBy(p => p.PluginSetting.IndexInList).ThenBy(p => p.PluginInfo.Name)); //----UI处理结束---- //显示免责声明 InitUi.InitWelcome(); //auto load plugins AutoLoadPlugins(_pluginsImport.Plugins); }