Exemple #1
0
 private void Logging_Log(LogEventArgs e)
 {
     BTSDeployForm.DeployForm.SetOutputTextBoxContentDelegate optDelegate =
         new BTSDeployForm.DeployForm.SetOutputTextBoxContentDelegate(gui.SetOutputTextBoxContent);
     gui.OutputTextBox.Invoke(optDelegate, new object[] { e.Message + Environment.NewLine });
     BTSDeployForm.DeployForm.SetToolStripStatusLabelDelegate stripDelegate =
         new BTSDeployForm.DeployForm.SetToolStripStatusLabelDelegate(gui.SetToolStripStatusLabel);
     gui.StatusStrip.Invoke(stripDelegate, new object[] { e.Message });
 }
Exemple #2
0
 private void LogLine(string value)
 {
     BTSDeployForm.DeployForm.SetOutputTextBoxContentDelegate optDelegate =
         new BTSDeployForm.DeployForm.SetOutputTextBoxContentDelegate(_gui.SetOutputTextBoxContent);
     _gui.OutputTextBox.Invoke(optDelegate, new object[] { value + Environment.NewLine });
 }
Exemple #3
0
        private void pipeline_StateChanged(object sender, PipelineStateEventArgs e)
        {
            Pipeline source = sender as Pipeline;
            // if the command completed update GUI.
            bool          updateGUI = false;
            bool          done      = false;
            StringBuilder output    = new StringBuilder();

            if (e.PipelineStateInfo.State == PipelineState.Completed)
            {
                done      = true;
                updateGUI = true;
                Collection <PSObject> results = source.Output.ReadToEnd();
                foreach (PSObject result in results)
                {
                    string resultString =
                        (string)LanguagePrimitives.ConvertTo(result, typeof(string));
                    output.Append(resultString);
                }
                output.Append("\nDone!");

                Failed       = false;
                ErrorMessage = string.Empty;

                // Do we need to log the result?
                LogInfo(Failed, ErrorMessage);
            }
            else if ((e.PipelineStateInfo.State == PipelineState.Stopped) ||
                     (e.PipelineStateInfo.State == PipelineState.Failed))
            {
                done      = true;
                updateGUI = true;
                Collection <PSObject> results = source.Output.ReadToEnd();
                foreach (PSObject result in results)
                {
                    string resultString =
                        (string)LanguagePrimitives.ConvertTo(result, typeof(string));
                    output.Append(resultString);
                }
                output.Append("\nFailure!");

                Failed       = true;
                ErrorMessage = string.Format("Command did not complete successfully. Reason: {0}", e.PipelineStateInfo.Reason.Message);

                // Do we need to log the result?
                LogInfo(Failed, ErrorMessage);
            }

            if (updateGUI)
            {
                BTSDeployForm.DeployForm.SetOutputTextBoxContentDelegate optDelegate =
                    new BTSDeployForm.DeployForm.SetOutputTextBoxContentDelegate(gui.SetOutputTextBoxContent);
                gui.OutputTextBox.Invoke(optDelegate, new object[] { output.ToString() });
                BTSDeployForm.DeployForm.SetRemoveButtonStateDelegate removeBtnDelegate =
                    new BTSDeployForm.DeployForm.SetRemoveButtonStateDelegate(gui.SetRemoveButtonState);
                gui.RemoveButton.Invoke(removeBtnDelegate, new object[] { false });
                BTSDeployForm.DeployForm.SetInvokeButtonStateDelegate invkBtnDelegate =
                    new BTSDeployForm.DeployForm.SetInvokeButtonStateDelegate(gui.SetInvokeButtonState);
                gui.InvokeButton.Invoke(invkBtnDelegate, new object[] { false });
                BTSDeployForm.DeployForm.SetStopButtonStateDelegate stpBtnDelegate =
                    new BTSDeployForm.DeployForm.SetStopButtonStateDelegate(gui.SetStopButtonState);
                gui.StopButton.Invoke(stpBtnDelegate, new object[] { false });
                BTSDeployForm.DeployForm.SetStartButtonStateDelegate strtBtnDelegate =
                    new BTSDeployForm.DeployForm.SetStartButtonStateDelegate(gui.SetStartButtonState);
                gui.StartButton.Invoke(strtBtnDelegate, new object[] { false });
                BTSDeployForm.DeployForm.SetRecycleButtonStateDelegate recycleBtnDelegate =
                    new BTSDeployForm.DeployForm.SetRecycleButtonStateDelegate(gui.SetRecycleButtonState);
                gui.RecycleButton.Invoke(recycleBtnDelegate, new object[] { false });
            }
            if (done)
            {
                BTSDeployForm.DeployForm.SetActionDoneDelegate doneDelegate =
                    new BTSDeployForm.DeployForm.SetActionDoneDelegate(gui.SetActionDone);
                gui.Form.Invoke(doneDelegate, new object[] {  });
            }
        }