Пример #1
0
 public StatusForm(SuperSchedulerData data, ScheduleExecutor executor)
 {
     InitializeComponent();
     this.ControlBox = false;
     SchedulerData = data;
     Executor = executor;
 }
Пример #2
0
        public StatusForm(SuperSchedulerData data, ScheduleExecutor executor)
        {
            InitializeComponent();

            ForeColor = ThemeColorTable.ForeColor;
            BackColor = ThemeColorTable.BackgroundColor;
            int iconSize = (int)(24 * ScalingTools.GetScaleFactor());

            buttonPauseShow.Image          = Tools.GetIcon(Resources.control_pause, iconSize);
            buttonPauseShow.Text           = "";
            buttonNextSong.Image           = Tools.GetIcon(Resources.control_end, iconSize);
            buttonNextSong.Text            = "";
            buttonStartScheduler.Image     = Tools.GetIcon(Resources.control_play_blue, iconSize);
            buttonStartScheduler.Text      = "";
            buttonStopNow.Image            = Tools.GetIcon(Resources.control_stop_blue, iconSize);
            buttonStopNow.Text             = "";
            buttonStopGracefully.Image     = Tools.GetIcon(Resources.clock_stop, iconSize);
            buttonStopGracefully.Text      = "";
            buttonViewLog.Image            = Tools.GetIcon(Resources.document_notes, iconSize);
            buttonViewLog.Text             = "";
            buttonPlayShowNow.Image        = Tools.GetIcon(Resources.control_play, iconSize);
            buttonPlayShowNow.Text         = "";
            buttonPlayShowGracefully.Image = Tools.GetIcon(Resources.clock_play, iconSize);
            buttonPlayShowGracefully.Text  = "";

            ThemeUpdateControls.UpdateControls(this);

            ControlBox    = false;
            SchedulerData = data;
            Executor      = executor;
        }
Пример #3
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");
            }
        }
Пример #4
0
        public StatusForm(SuperSchedulerData data, ScheduleExecutor executor)
        {
            InitializeComponent();

            buttonPauseShow.Image = Tools.GetIcon(Resources.control_pause, 16);
            buttonPauseShow.Text = "";
            buttonNextSong.Image = Tools.GetIcon(Resources.control_end, 16);
            buttonNextSong.Text = "";
            buttonStartScheduler.Image = Tools.GetIcon(Resources.control_play, 16);
            buttonStartScheduler.Text = "";
            buttonStopNow.Image = Tools.GetIcon(Resources.control_stop, 16);
            buttonStopNow.Text = "";
            buttonStopGracefully.Image = Tools.GetIcon(Resources.clock_stop, 16);
            buttonStopGracefully.Text = "";
            buttonViewLog.Image = Tools.GetIcon(Resources.document_notes, 16);
            buttonViewLog.Text = "";

            buttonPlayShowNow.Image = Tools.GetIcon(Resources.control_play, 16);
            buttonPlayShowNow.Text = "";
            buttonPlayShowGracefully.Image = Tools.GetIcon(Resources.clock_play, 16);
            buttonPlayShowGracefully.Text = "";

            ControlBox = false;
            SchedulerData = data;
            Executor = executor;
        }
Пример #5
0
        private void ExecuteAction(Shows.Action action)
        {
            LogScheduleInfoEntry(string.Format("ExecuteAction: {0} with state of {1}", action.ShowItem.Name, State));

            if (State != StateType.Waiting)
            {
                if (!action.PreProcessingCompleted)
                {
                    ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Pre-processing action: " + action.ShowItem.Name);

                    // Do this in a task so we don't stop Vixen while pre-processing!
                    tokenSourcePreProcess = new CancellationTokenSource();
                    Task preProcessTask = new Task(() => action.PreProcess(), tokenSourcePreProcess.Token);
                    preProcessTask.ContinueWith(task =>
                    {
                        ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Starting action: " + action.ShowItem.Name);
                        action.Execute();
                        RunningActions.Add(action);
                    }
                                                );

                    preProcessTask.Start();
                }
                else
                {
                    ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Starting action: " + action.ShowItem.Name);
                    action.Execute();
                    RunningActions.Add(action);
                }
            }
        }
Пример #6
0
        public StatusForm(SuperSchedulerData data, ScheduleExecutor executor)
        {
            InitializeComponent();

            buttonPauseShow.Image      = Tools.GetIcon(Resources.control_pause, 16);
            buttonPauseShow.Text       = "";
            buttonNextSong.Image       = Tools.GetIcon(Resources.control_end, 16);
            buttonNextSong.Text        = "";
            buttonStartScheduler.Image = Tools.GetIcon(Resources.control_play, 16);
            buttonStartScheduler.Text  = "";
            buttonStopNow.Image        = Tools.GetIcon(Resources.control_stop, 16);
            buttonStopNow.Text         = "";
            buttonStopGracefully.Image = Tools.GetIcon(Resources.clock_stop, 16);
            buttonStopGracefully.Text  = "";
            buttonViewLog.Image        = Tools.GetIcon(Resources.document_notes, 16);
            buttonViewLog.Text         = "";

            buttonPlayShowNow.Image        = Tools.GetIcon(Resources.control_play, 16);
            buttonPlayShowNow.Text         = "";
            buttonPlayShowGracefully.Image = Tools.GetIcon(Resources.clock_play, 16);
            buttonPlayShowGracefully.Text  = "";


            ControlBox    = false;
            SchedulerData = data;
            Executor      = executor;
        }
Пример #7
0
        public StatusForm(SuperSchedulerData data, ScheduleExecutor executor)
        {
            InitializeComponent();

            ForeColor = ThemeColorTable.ForeColor;
            BackColor = ThemeColorTable.BackgroundColor;
            ThemeUpdateControls.UpdateControls(this);
            buttonPauseShow.Image = Tools.GetIcon(Resources.control_pause, 24);
            buttonPauseShow.Text = "";
            buttonNextSong.Image = Tools.GetIcon(Resources.control_end, 24);
            buttonNextSong.Text = "";
            buttonStartScheduler.Image = Tools.GetIcon(Resources.control_play_blue, 24);
            buttonStartScheduler.Text = "";
            buttonStopNow.Image = Tools.GetIcon(Resources.control_stop_blue, 24);
            buttonStopNow.Text = "";
            buttonStopGracefully.Image = Tools.GetIcon(Resources.clock_stop, 24);
            buttonStopGracefully.Text = "";
            buttonViewLog.Image = Tools.GetIcon(Resources.document_notes, 24);
            buttonViewLog.Text = "";
            buttonPlayShowNow.Image = Tools.GetIcon(Resources.control_play, 24);
            buttonPlayShowNow.Text = "";
            buttonPlayShowGracefully.Image = Tools.GetIcon(Resources.clock_play, 24);
            buttonPlayShowGracefully.Text = "";

            ControlBox = false;
            SchedulerData = data;
            Executor = executor;
        }
Пример #8
0
 public StatusForm(SuperSchedulerData data, ScheduleExecutor executor)
 {
     InitializeComponent();
     this.ControlBox = false;
     SchedulerData   = data;
     Executor        = executor;
 }
Пример #9
0
        public override void Loading()
        {
            //_synchronizationContext = SynchronizationContext.Current;

            CreateMenu();
            //SetSchedulerEnableState(_data.IsEnabled);
            _executor = new ScheduleExecutor(_data);
        }
Пример #10
0
		public override void Loading()
		{
			//_synchronizationContext = SynchronizationContext.Current;

			CreateMenu();
			//SetSchedulerEnableState(_data.IsEnabled);
			_executor = new ScheduleExecutor(_data);
		}
Пример #11
0
 public void OnShutdownActionComplete(object sender, EventArgs e)
 {
     Shows.Action action = (sender as Shows.Action);
     action.ActionComplete -= OnShutdownActionComplete;
     RunningActions.Remove(action);
     ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Shutdown action complete: " + action.ShowItem.Name);
     ExecuteNextShutdownItem();
 }
Пример #12
0
 public void OnSequentialActionComplete(object sender, EventArgs e)
 {
     Shows.Action action = (sender as Shows.Action);
     action.ActionComplete -= OnSequentialActionComplete;
     RunningActions.Remove(action);
     ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Sequential action complete: " + action.ShowItem.Name);
     if (!StartShutdownIfRequested())
     {
         LogScheduleInfoEntry("OnSequentialActionComplete: Shutdown was NOT requested");
         ExecuteNextSequentialItem();
     }
 }
Пример #13
0
        public void OnBackgroundActionComplete(object sender, EventArgs e)
        {
            Shows.Action action = (sender as Shows.Action);
            action.ActionComplete -= OnBackgroundActionComplete;
            RunningActions.Remove(action);
            ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Background action complete: " + action.ShowItem.Name);

            // Run it again and again and again and again and again and again and again and...
            if (!CheckForShutdown())
            {
                ExecuteBackgroundAction(action);
            }
        }
Пример #14
0
        public void OnStartupActionComplete(object sender, EventArgs e)
        {
            var action = (sender as Shows.Action);

            if (action != null)
            {
                action.ActionComplete -= OnStartupActionComplete;
                RunningActions.Remove(action);

                ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Startup action complete: " + action.ShowItem.Name);
                action.Dispose();
            }
            ExecuteNextStartupItem();
        }
Пример #15
0
 public void ExecuteNextShutdownItem()
 {
     if (ItemQueue.Any())
     {
         _currentItem = ItemQueue.Dequeue();
         Shows.Action action = _currentItem.GetAction();
         action.ActionComplete += OnShutdownActionComplete;
         ExecuteAction(action);
         // Otherwise, the show is done :(
     }
     else
     {
         State = StateType.Waiting;
         ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Show complete");
         Show.ReleaseAllActions();
     }
 }
Пример #16
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.");
                }
            }
        }
Пример #17
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();
            }
        }
Пример #18
0
        private void PreProcessActionTask()
        {
            // Pre-Process all the actions to fill up our memory

            //Show.GetItems(Shows.ShowItemType.All).AsParallel().WithCancellation(tokenSourcePreProcessAll.Token).ForAll(
            //	item => {
            foreach (ShowItem item in Show.GetItems(ShowItemType.All))
            {
                ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Pre-processing: " + item.Name);
                var action = item.GetAction();

                if (!action.PreProcessingCompleted)
                {
                    action.PreProcess(tokenSourcePreProcessAll);
                }
                //if (tokenSourcePreProcessAll != null && tokenSourcePreProcessAll.IsCancellationRequested)
                //	return;
                //};
            }
        }
Пример #19
0
        public void Start(bool manuallyStarted)
        {
            State = StateType.Running;

            InProcessEndTime = EndTime;

            ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Show started");

            // Do this in a task so we don't stop Vixen while pre-processing!
            if (tokenSourcePreProcessAll == null || tokenSourcePreProcessAll.IsCancellationRequested)
            {
                tokenSourcePreProcessAll = new CancellationTokenSource();
            }

            var preProcessTask = new Task(a => PreProcessActionTask(), tokenSourcePreProcessAll.Token);

            preProcessTask.ContinueWith(task => BeginStartup(), tokenSourcePreProcessAll.Token);

            preProcessTask.Start();
        }
Пример #20
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();
            }
        }
Пример #21
0
 public override void Unloading()
 {
     //SetSchedulerEnableState(false);
     _executor = null;
 }
Пример #22
0
 public override void Unloading()
 {
     //SetSchedulerEnableState(false);
     _executor = null;
 }
Пример #23
0
 public void Shutdown()
 {
     ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Shutdown Requested");
     State = StateType.Shutdown;
 }