using System; using System.Collections.Generic; using System.Linq; using System.Text; using Mesnac.Action.Base; namespace Mesnac.Action.Feeding.Qingquan.Sys { /// /// 系统版本控制器(单机、网络) /// public class SysVersionController { /// /// 版本变更事件 /// public static event EventHandler OnVersionChange; #region 处理版本信息 /// /// 处理版本信息 /// public static void ProcessVersion() { //判断是否由于断网导致系统自动切换的单机版 FeedingAction action = new FeedingAction(); if (action.NetType == BaseAction.NetTypes.Local && action.OriginalNetType == BaseAction.NetTypes.Net) { if (PlanCommon.IsCanConnectServer()) { action.SetGlobalNetType(Mesnac.Action.Base.BaseAction.NetTypes.Net); ICSharpCode.Core.LoggingService.Warn("网络库连接成功,由临时单机转为网络版运行!"); //触发版本变更事件 if (SysVersionController.OnVersionChange != null) { SysVersionController.OnVersionChange(null, System.EventArgs.Empty); } } } else if (action.NetType == BaseAction.NetTypes.Net) //如果是网络版,则判断网络库是否能够连接上,连接不上,自动转为临时单机 { if (!PlanCommon.IsCanConnectServer()) { action.SetGlobalNetType(Mesnac.Action.Base.BaseAction.NetTypes.Local); ICSharpCode.Core.LoggingService.Warn("刷新网络计划失败:连接网络库失败,转为单机版运行!"); //触发版本变更事件 if (SysVersionController.OnVersionChange != null) { SysVersionController.OnVersionChange(null, System.EventArgs.Empty); } } } } #endregion } }