private JavaScriptValue SetWnBrowerTileAndSubtitle(Formium owner, JavaScriptValue[] arguments) { try { if (arguments.Length == 0) { return(JavaScriptValue.CreateString("无参数")); } if (arguments.Length > 1) { var strTitle = arguments[0].GetString(); var strSubtitle = arguments[1].GetString(); if (!string.IsNullOrWhiteSpace(strTitle) && !string.IsNullOrWhiteSpace(strSubtitle)) { owner.Title = strTitle; owner.Subtitle = strSubtitle; Wnconfig.SetAppsettingValue("Title", strTitle); Wnconfig.SetAppsettingValue("Subtitle", strSubtitle); } } else { JavaScriptValue.CreateString("调用失败!SetWnBrowerTileAndSubtitle至少需要两个参数!(Title,Subtitle)"); } } catch (Exception ex) { return(JavaScriptValue.CreateString(ex.Message)); } return(JavaScriptValue.CreateString("调用SetWnBrowerTileAndSubtitle成功")); }
private void MainForm_DocumentTitleChanged(object sender, NetDimension.NanUI.Browser.DocumentTitleChangedEventArgs e) { try { if (Wnconfig.GetUrl().Contains(e.Title)) { return; } this.Title = e.Title; this.Subtitle = ""; Wnconfig.SetAppsettingValue("Title", this.Title); Wnconfig.SetAppsettingValue("Subtitle", this.Subtitle); if (this.Title != "社区卫生信息系统") { ShortCutHelper.SetWinningBrowerShortcut(this.Title, Application.ExecutablePath); } } catch (Exception) { } //throw new NotImplementedException(); }
public static string GetShortName() { if (string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["AppNameURL"])) { return(GetAppSettingShortName()); } MyWebClient wc = new MyWebClient(); try { string strShortName = ""; string url = ConfigurationManager.AppSettings["AppNameURL"]; strShortName = wc.DownloadString(url); Wnconfig.SetAppsettingValue("ShortcutNameOnDesktop", strShortName); return(strShortName); } catch (Exception) { return(null); } finally { wc = null; } }
public static void SetWinningBrowerShortcut(string strShortcutName, string strExecutablePath) { try { if (string.IsNullOrWhiteSpace(strShortcutName) || !System.IO.File.Exists(strExecutablePath)) { return; } string desktop = Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory);//获取桌面文件夹路径 //string shortcutdir=Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu),"卫宁基层卫生信息系统V5.6");//获取开始菜单文件夹路径 string shortcutPath = Path.Combine(desktop, string.Format("{0}.lnk", "卫宁基层卫生信息系统V5.6")); string newShortcutpath = Path.Combine(desktop, string.Format("{0}.lnk", strShortcutName)); //string midShortCutpath = Path.Combine(desktop, string.Format("{0}.lnk", "社区卫生信息系统")); //社区卫生信息系统 if (System.IO.File.Exists(shortcutPath)) { if (System.IO.File.Exists(newShortcutpath)) { System.IO.File.Delete(shortcutPath); return; } else { System.IO.File.Move(shortcutPath, newShortcutpath); Wnconfig.SetAppsettingValue("ShortcutNameOnDesktop", strShortcutName); return; } } else if (!string.IsNullOrWhiteSpace(Wnconfig.GetAppSettingShortName()) && System.IO.File.Exists(Path.Combine(desktop, string.Format("{0}.lnk", Wnconfig.GetAppSettingShortName())))) { // System.IO.File.Delete(Path.Combine(desktop, string.Format("{0}.lnk", Wnconfig.GetAppSettingShortName()))); System.IO.File.Move(Path.Combine(desktop, string.Format("{0}.lnk", Wnconfig.GetAppSettingShortName())), Path.Combine(desktop, string.Format("{0}.lnk", strShortcutName))); Wnconfig.SetAppsettingValue("ShortcutNameOnDesktop", strShortcutName); return; } CreateShortcutOnDesktop(strShortcutName, strExecutablePath); Wnconfig.SetAppsettingValue("ShortcutNameOnDesktop", strShortcutName); } catch (Exception ex) { } }
private JavaScriptValue GrayEnable(Formium owner, JavaScriptValue[] arguments) { try { if (arguments.Length == 0) { return(JavaScriptValue.CreateString("无参数")); } if (arguments.Length > 0 && !string.IsNullOrWhiteSpace(arguments[0].GetString())) { var bGrayEnable = Convert.ToBoolean(arguments[0].GetString()); Wnconfig.SetAppsettingValue("GrayFlag", bGrayEnable.ToString()); } } catch (Exception ex) { return(JavaScriptValue.CreateString(ex.Message)); } return(JavaScriptValue.CreateString("调用GrayEnable成功")); }