private static void StartProgram(AMSEvent eventData, AMSChannel channel, AMSEventChannel ec, CancellationToken cancellationToken) { TraceHelper.AMSTaskTraceSource.TraceEvent(TraceEventType.Verbose, 60017, "Start Program:\n{0}", channel.ToTraceInfo()); SimulateOrExecuteAction(() => LiveChannelManager.StartProgram(channel, eventData, ec), () => ec.State = AMSEventState.Running); AMSEventSqlAdapter.Instance.UpdateEventChannel(ec); TraceHelper.AMSTaskTraceSource.TraceEvent(TraceEventType.Verbose, 60017, "Program Started:\n{0}", channel.ToTraceInfo()); }
public static void StopChannel(AMSQueueItem message, CancellationToken cancellationToken) { AMSChannel channel = AMSChannelSqlAdapter.Instance.LoadByID(message.ResourceID); if (channel != null) { TraceHelper.AMSTaskTraceSource.TraceEvent(TraceEventType.Verbose, 60014, "Stop Channel:\n{0}", channel.ToTraceInfo()); if (channel.State == AMSChannelState.Stopped) { AMSChannelSqlAdapter.Instance.UpdateState(channel.ID, AMSChannelState.Stopping); } SimulateOrExecuteAction(() => LiveChannelManager.StopChannel(channel), () => channel.State = AMSChannelState.Stopped); AMSChannelSqlAdapter.Instance.Update(channel); TraceHelper.AMSTaskTraceSource.TraceEvent(TraceEventType.Verbose, 60014, "Channel Stopped:\n{0}", channel.ToTraceInfo()); } }
/// <summary> /// 启动频道,并且更新频道状态 /// </summary> /// <param name="channelID"></param> /// <param name="cancellationToken"></param> /// <returns></returns> private static AMSChannel StartChannel(string channelID, CancellationToken cancellationToken) { AMSChannel channel = AMSChannelSqlAdapter.Instance.LoadByID(channelID); if (channel != null) { TraceHelper.AMSTaskTraceSource.TraceEvent(TraceEventType.Verbose, 60016, "Start Channel:\n{0}", channel.ToTraceInfo()); if (channel.State == AMSChannelState.Stopped) { AMSChannelSqlAdapter.Instance.UpdateState(channel.ID, AMSChannelState.Starting); } SimulateOrExecuteAction(() => LiveChannelManager.StartChannel(channel), () => channel.State = AMSChannelState.Running); AMSChannelSqlAdapter.Instance.Update(channel); TraceHelper.AMSTaskTraceSource.TraceEvent(TraceEventType.Verbose, 60016, "Channel Started:\n{0}", channel.ToTraceInfo()); } return(channel); }
private static void InnerStartProgram(AMSEvent eventData, AMSChannel channel, AMSEventChannel ec, CancellationToken cancellationToken) { TraceHelper.AMSTaskTraceSource.TraceEvent(TraceEventType.Verbose, 60017, "Start Program:\n{0}", channel.ToTraceInfo()); SimulateOrExecuteAction(() => LiveChannelManager.StartProgram(channel, eventData, ec), () => ec.State = AMSEventState.Running); AMSEventSqlAdapter.Instance.UpdateEventChannel(ec); TraceHelper.AMSTaskTraceSource.TraceEvent(TraceEventType.Verbose, 60017, "Program Started:\n{0}", channel.ToTraceInfo()); }