public static SyncTime GetSyncTime() { if (null == syncTime) { syncTime = new SyncTime(); } return(syncTime); }
/// <summary> /// 加载 /// </summary> /// <param name="adminNo"></param> /// <param name="password"></param> /// <returns></returns> public ResultModel Load(string adminNo, string password) { ResultModel result = new ResultModel(); //自动校准服务器时间到客户端 if (Resources.GetRes().AutoSyncClientTime) { if (Resources.GetRes().SERVER_ADDRESS != "127.0.0.1" && Resources.GetRes().SERVER_ADDRESS != "::1") { SyncTime.GetSyncTime().SyncServerTimeToClient(); } } // 如果登录的IP是本地, 查看有没有服务, 有就查是否启动了, 没启动就启动它 if (Resources.GetRes().SERVER_ADDRESS == "127.0.0.1" || Resources.GetRes().SERVER_ADDRESS == "::1") { try { // 获取本地的服务 ServiceController ctl = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == "OybabTradingSystemService"); if (ctl != null) { // 如果服务停止了, 则启动它 if (ctl.Status == ServiceControllerStatus.Stopped) { ctl.Start(); ctl.WaitForStatus(ServiceControllerStatus.Stopped, new TimeSpan(0, 0, 15)); } } } catch { } } //新请求 if (!Resources.GetRes().IsSessionExists()) { result = OperatesService.GetOperates().NewRequest(adminNo, password); } return(result); }