示例#1
0
        public void Stop(bool graceful)
        {
            if (tokenSourcePreProcess != null && tokenSourcePreProcess.Token.CanBeCanceled)
            {
                tokenSourcePreProcess.Cancel(false);
            }
            if (tokenSourcePreProcessAll != null && tokenSourcePreProcessAll.Token.CanBeCanceled)
            {
                tokenSourcePreProcessAll.Cancel(false);
            }

            if (graceful)
            {
                State = StateType.Shutdown;
                ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Show stopping gracefully");
            }
            else
            {
                State = StateType.Waiting;
                int runningCount = RunningActions.Count();

                ItemQueue.Clear();
                for (int i = 0; i < runningCount; i++)
                {
                    ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Stopping action: " + RunningActions[i].ShowItem.Name);
                    RunningActions[i].Stop();
                }
                Show.ReleaseAllActions();
                ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Show stopped immediately");
            }
        }
示例#2
0
        public void Stop(bool graceful)
        {
            if (tokenSourcePreProcess != null && tokenSourcePreProcess.Token.CanBeCanceled)
            {
                tokenSourcePreProcess.Cancel(false);
            }
            if (tokenSourcePreProcessAll != null && tokenSourcePreProcessAll.Token.CanBeCanceled)
            {
                tokenSourcePreProcessAll.Cancel(false);
            }

            if (graceful)
            {
                State = StateType.Shutdown;
                ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Show stopping gracefully");
            }
            else
            {
                State = StateType.Waiting;

                ItemQueue.Clear();

                Action[] actions;
                lock (_actionLock)
                {
                    actions = RunningActions.ToArray();
                }

                foreach (var action in actions)
                {
                    ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Stopping action: " + action.ShowItem.Name);
                    action.Stop();
                }

                if (Show != null)
                {
                    Show.ReleaseAllActions();
                    ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Show stopped immediately");
                }
                else
                {
                    ScheduleExecutor.AddSchedulerLogEntry("No show selected", "Nothing to stop.");
                }
            }
        }
示例#3
0
        public void BeginShutdown()
        {
            if (Show != null)
            {
                ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Starting shutdown");

                StopBackground();
                StopSequential();
                ItemQueue.Clear();

                State = StateType.Shutdown;
                foreach (ShowItem item in Show.GetItems(Shows.ShowItemType.Shutdown))
                {
                    LogScheduleInfoEntry(string.Format("BeginShutdown: Enqueue: {0}", item.Name));
                    ItemQueue.Enqueue(item);
                }

                ExecuteNextShutdownItem();
            }
        }
示例#4
0
        public void BeginShutdown()
        {
            if (Show != null)
            {
                ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Starting shutdown");

                StopBackground();

                ItemQueue.Clear();

                State = StateType.Shutdown;
                foreach (Shows.ShowItem item in Show.GetItems(Shows.ShowItemType.Shutdown))
                {
                    ScheduleExecutor.Logging.Info("BeginShutdown: Enqueue: " + item.Name);
                    ItemQueue.Enqueue(item);
                }

                ExecuteNextShutdownItem();
            }
        }
示例#5
0
 /// <summary>
 /// Clears the ItemQueue.
 /// </summary>
 public override void Flush()
 {
     ItemQueue.Clear();
 }