Exemplo n.º 1
0
        private void _shell_PipelineStateChangedReceived(object sender, PipelineStateEventArg arg)
        {
            Dispatcher.Invoke(() =>
            {
                switch (arg.State)
                {
                case PipelineState.Stopped:
                case PipelineState.Failed:
                case PipelineState.Completed:
                    StatusLedColor(Colors.Transparent);
                    Progress.IsIndeterminate = false;
                    StatusText.Text          = "Completed";
                    _shell = null;
                    break;

                case PipelineState.Stopping:
                    StatusText.Text = "Stopping";
                    StatusLedColor(Colors.Orange);
                    break;

                case PipelineState.Running:
                    StatusText.Text = "Running ...";
                    StatusLedColor(Colors.LightGreen);
                    break;
                }
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Triggered when the PowerShell pipeline state changed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        void poshEngine_PipelineStateChangedReceived(object sender, PipelineStateEventArg arg)
        {
            PipelineStatusTextBlock.Dispatcher.Invoke(new Action(() => PipelineStatusTextBlock.Text = arg.State.ToString()));

            if (arg.State == PipelineState.Stopped || arg.State == PipelineState.Failed || arg.State == PipelineState.Completed)
            {
                this.Dispatcher.Invoke(new Action(ScriptFinished));
            }
            else if (arg.State == PipelineState.Stopping)
            {
                this.Dispatcher.Invoke(new Action(() => PipelineBorder.Background = new SolidColorBrush(Colors.Orange)));
            }
            else if (arg.State == PipelineState.Running)
            {
                this.Dispatcher.Invoke(new Action(() => PipelineBorder.Background = new SolidColorBrush(Colors.LightGreen)));
            }
        }