/// <summary>判断是否需要显示换产提醒 /// /// </summary> /// <param name="newvin"></param> public static void GetChange(VinMsg newvin) { if (newvin != null) { if (LastVinMsg == null || LastVinMsg.ZTBM != newvin.ZTBM) { var s1 = LastVinMsg?.ZTBM ?? "空"; var s2 = newvin?.ZTBM ?? "空"; ToolAlarm.ShowDialog(string.Format("换型:\r\n{0}→{1}", s1, s2)); } } }
/// <summary>判断服务端或客户端模式,该函数必须调用 /// /// </summary> /// <returns>true=服务端模式,false=客户端模式</returns> public static bool CheckClientOrServerMode() { List <string> ips = QL_Net.GetHostIPs(); 当前为服务端模式 = ips.Exists((string ip) => ip == AppConfig.FEILUN_SERVERIP.Address.ToString()); string[] msg = new string[] { "当前以" + (当前为服务端模式 ? "服务端" : "客户端") + "模式运行", "服务端:" + AppConfig.FEILUN_SERVERIP, "客户端:" + AppConfig.FEILUN_CLIENTIP, }; ToolAlarm.ShowDialog(string.Join("\r\n", msg)); return(当前为服务端模式); }
/// <summary>开始进行同步更新并提示相关信息 /// /// </summary> /// <returns></returns> public static bool Update() { if (!ApplicationDeployment.IsNetworkDeployed) { return(false); } var ad = ApplicationDeployment.CurrentDeployment; ToolAlarm.ShowDialog("该程序版本已经过期,即将更新到最新版!", 2000); try { ad.Update(); ToolAlarm.ShowDialog("程序已经更新完成,请重新启动应用程序", 2000); } catch (Exception exc) { MessageBox.Show("无法更新程序,请检查网络或稍后再尝试:" + exc.Message.ToString()); return(false); } Application.Restart(); return(true); }
/// <summary>使用自有逻辑判断是否需要更新程序 /// /// </summary> /// <param name="DBVersion"></param> /// <param name="err"></param> /// <returns></returns> public static bool CheckForUpdate(string DBVersion) { if (!ApplicationDeployment.IsNetworkDeployed)//不是网络部署程序 { return(false); } var ad = ApplicationDeployment.CurrentDeployment; if (!CheckForUpdate_Result)//不需要更新,已经是最新版了 { return(false); } if (string.IsNullOrWhiteSpace(DBVersion)) { ToolAlarm.ShowDialog("允许运行的最低版本:" + DBVersion + "不正确,请提醒管理人员处理", 3000); return(false); } if (DBVersion.ToUpper() == DBVersionKeyWord_New.ToUpper()) { return(true); } if (DBVersion.ToUpper() == DBVersionKeyWord_Old.ToUpper()) { return(false); } Version DBVersion_Temp; try { DBVersion_Temp = new Version(DBVersion); } catch { ToolAlarm.ShowDialog("允许运行的最低版本:" + DBVersion + "不正确,请提醒管理人员处理", 3000); return(false); } return(ad.CurrentVersion < DBVersion_Temp); }
/// <summary>弹出一个窗口并在倒计时若干毫秒后关闭 /// /// </summary> /// <param name="msg"></param> /// <param name="millsecond"></param> public static void ShowDialog(string msg, int millsecond = 0) { ToolAlarm ta = new ToolAlarm(msg, millsecond); ta.ShowDialog(); }