private Settings curSet; //当前设置,内有当前皮肤名字 /// <summary> /// 这个方法在插件启动时被调用。 /// </summary> /// <param name="args"></param> public void Run(PEPlugin.IPERunArgs args) { Console.WriteLine("pe插件开始运行!"); peArgs = args;//保存这个IPERunArgs //文件夹检测,没有该文件夹就创建 string path = new FileInfo(peArgs.Host.Connector.System.HostApplicationPath).DirectoryName + @"\_data\weituotian\"; DirectoryInfo dir = new DirectoryInfo(path); if (!dir.Exists) { dir.Create(); } //配置文件路径 settingxml = path + "skin.xml"; //dll文件名 string dllFileName = "IrisSkin4.dll"; //******没有IrisSkin4.dll就写出到目录****** if (!File.Exists(path + dllFileName)) //文件不存在 { FileStream fs = new FileStream(path + dllFileName, FileMode.CreateNew, FileAccess.Write); byte[] buffer = Resource2.IrisSkin4; fs.Write(buffer, 0, buffer.Length); fs.Close(); } //****************** Form mainForm = peArgs.Host.Connector.Form as Form;//主窗口 //改变皮肤 //加载dll ass = Assembly.LoadFrom(path + dllFileName); //创建skin实例 skinType = ass.GetType("Sunisoft.IrisSkin.SkinEngine"); skin = Activator.CreateInstance(skinType); //设置skin的属性Active PropertyInfo Active = skinType.GetProperty("Active"); Active.SetValue(skin, true, null); //加载配置的指定的皮肤 curSet = Utils.loadSettings(settingxml); changeStyle(curSet.styleName); #region 原始调用方法 //Sunisoft.IrisSkin.SkinEngine skin = new Sunisoft.IrisSkin.SkinEngine(); //skin.SkinStream = ; //skin.Active = true; #endregion addComboBox(mainForm); }
/// <summary> /// 这个方法在插件启动时被调用。 /// </summary> /// <param name="args"></param> public void Run(PEPlugin.IPERunArgs args) { Console.WriteLine("pe插件开始运行!"); peArgs = args;//保存这个IPERunArgs Form mainForm = peArgs.Host.Connector.Form as Form;//主窗口 addTabPage(mainForm); }
/// <summary> /// 这个方法在插件启动时被调用。 /// </summary> /// <param name="args"></param> public void Run(PEPlugin.IPERunArgs args) { Console.WriteLine("pe插件开始运行!"); peArgs = args;//保存这个IPERunArgs System.Windows.Forms.Form mainForm = peArgs.Host.Connector.Form as System.Windows.Forms.Form; //主窗口 addNewMenus(mainForm); //添加菜单 //文件夹检测,没有该文件夹就创建 path = new FileInfo(peArgs.Host.Connector.System.HostApplicationPath).DirectoryName + @"\_data\weituotian\"; DirectoryInfo dir = new DirectoryInfo(path); if (!dir.Exists) { dir.Create(); } //初始化文件路径 fontxml = path + "font.xml"; //读取保存的字体 settings = Utils.loadSettings(fontxml); if (settings == null)//配置文件读取失败 { //第一次启动 settings = new Settings(mainForm.Font);//当前字体设置为pe窗口的默认字体 menuitem1_3.Text = str_bootUpNo; //font = new Font("MS UI Gothic", 9f);//当前字体设置为默认字体 Utils.saveSettings(fontxml, settings); } else { if (settings.bootup) //默认启动修改字体 { menuitem1_3.Text = str_bootUpYes; //设置提示信息 changeAllFormsFont(settings.font); } else { menuitem1_3.Text = str_bootUpNo; } } }