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");
            }
        }
Example #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.");
                }
            }
        }
Example #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();
            }
        }
        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();
            }
        }
Example #5
0
 /// <summary>
 /// Clears the ItemQueue.
 /// </summary>
 public override void Flush()
 {
     ItemQueue.Clear();
 }