/// <summary> /// 读取实例 /// </summary> /// <param name="programInfo">工程项目信息</param> /// <param name="serviceHoseAddr">服务主机地址</param> /// <param name="autoReportRunningInterval">自动运行时间</param> /// <returns></returns> public static ListenClient GetNewInstance(ProgramInfo programInfo, string serviceHoseAddr = null, int autoReportRunningInterval = 300) { instance = new ListenClient(programInfo, serviceHoseAddr, autoReportRunningInterval); instance.BuildListenClientService(); return(instance); }
public static void SaveProgramStartInfo(ProgramInfo programInfo, IListenCall listenCall) { programInfo.RunState = 0; ProgramInfos.AddOrUpdate(programInfo.Id, programInfo, (key, value) => programInfo); ListenCalls.AddOrUpdate(programInfo.Id, listenCall, (key, value) => listenCall); WriteLog(string.Format("程序名称:{0},版本:{1} 已经启动运行", programInfo.name, programInfo.Version), false); }
public void ReportRunning(ProgramInfo programInfo) { Console.WriteLine(string.Format("{0}-{1}", programInfo.Id, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))); var listenCall = OperationContext.Current.GetCallbackChannel <IListenCall>(); Common.SaveProgramRunningInfo(programInfo, listenCall); }
internal static void SaveProgramRunningInfo(ProgramInfo programInfo, IListenCall listenCall) { if (!ProgramInfos.ContainsKey(programInfo.Id) || !ListenCalls.ContainsKey(programInfo.Id)) { SaveProgramStartInfo(programInfo, listenCall); } programInfo.RunState = 1; RefreshTabControl(programInfo, true); WriteLog(string.Format("程序名:{0},版本:{1},正在运行", programInfo.name, programInfo.Version), false); }
private ListenClient(ProgramInfo programInfo, string serviceHostAddr = null, int autoReportRunningInterval = 300) { programInfo.Id = CreateProgramId(); this.programInfo = programInfo; this.serviceHostAddr = serviceHostAddr; if (autoReportRunningInterval >= 60) //最低1分钟的间隔 { this.autoReportRunningInterval = autoReportRunningInterval; } BuildAutoReportRunningTimer(); }
private void AppendTextToRichTextBox(RichTextBox rchTextBox, Core.ProgramInfo programInfo) { Color msgColor = Color.Black; string lineMsg = string.Format("{0:yyyy-MM-dd HH:mm}\t{1}({2})\t{3} \n", DateTime.Now, programInfo.Name, programInfo.Version, GetRunStateString(programInfo.RunState, out msgColor)); rchTextBox.SelectionColor = msgColor; rchTextBox.SelectionStart = rchTextBox.Text.Length; rchTextBox.AppendText(lineMsg); rchTextBox.SelectionLength = rchTextBox.Text.Length; if (rchTextBox.Lines.Length > 1000) { } }
public static ListenClient GetInstance(ProgramInfo programInfo, string serviceHostAddr = null, int autoReportRunningInterval = 300) { if (instance == null) { lock (syncObject) { if (instance == null) { instance = new ListenClient(programInfo, serviceHostAddr, autoReportRunningInterval); instance.BuildListenClientService(); } } } return(instance); }
public void Start(ProgramInfo propInfo) { var listenCall = OperationContext.Current.GetCallbackChannel <IListenCall>(); Common.SaveProgramStartInfo(propInfo, listenCall); }
public void ReportRunning(ProgramInfo programInfo) { var listenCall = OperationContext.Current.GetCallbackChannel <IListenCall>(); Common.SaveProgramRunningInfo(programInfo, listenCall); }