private void _shell_RunspaceStateChangedReceived(object sender, RunspaceStateEventArg arg) { Dispatcher.Invoke(() => { switch (arg.State) { case RunspaceState.Opening: case RunspaceState.Closing: StatusLedColor(Colors.Orange); break; case RunspaceState.Opened: StatusLedColor(Colors.LightGreen); break; case RunspaceState.Closed: StatusLedColor(Colors.Transparent); _shell = null; break; case RunspaceState.Broken: Progress.IsIndeterminate = false; StatusLedColor(Colors.Red); break; } }); }
private void RunspaceStateChanged(RunspaceStateEventArg arg) { RunspaceStatusTextBlock.Text = arg.State.ToString(); if (arg.State == RunspaceState.Opening || arg.State == RunspaceState.Closing) { RunspaceBorder.Background = new SolidColorBrush(Colors.Orange); } else if (arg.State == RunspaceState.Opened) { RunspaceBorder.Background = new SolidColorBrush(Colors.LightGreen); } else if (arg.State == RunspaceState.Closed) { StatusProgress.IsIndeterminate = false; RunspaceBorder.Background = new SolidColorBrush(Colors.Transparent); } else if (arg.State == RunspaceState.Broken) { StatusProgress.IsIndeterminate = false; RunspaceBorder.Background = new SolidColorBrush(Colors.Red); } }
/// <summary> /// Triggered when the runspace state changed /// </summary> /// <param name="sender"></param> /// <param name="arg"></param> void poshEngine_RunspaceStateChangedReceived(object sender, RunspaceStateEventArg arg) { this.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => RunspaceStateChanged(arg))); }