コード例 #1
0
        private void btnEditPipelineScript_Click(object sender, RoutedEventArgs e)
        {
            Button btnSource = (Button)sender;

            DeliveryPipeline pipeline = (DeliveryPipeline)btnSource.DataContext;

            try
            {
                string localDirectory = pipeline.GetWorkingDirectory();

                if (localDirectory != null)
                {
                    string envConfigPath = string.Format("{0}\\{1}.ps1", localDirectory, pipeline.ScriptName);

                    if (!File.Exists(envConfigPath))
                    {
                        throw new Exception(
                                  string.Format("File:\n\n{0}\n\nCouldn't be found on disk. Did you move your working folder?", envConfigPath));
                    }

                    ProcessStartInfo psi = new ProcessStartInfo();
                    psi.Verb     = "edit";
                    psi.FileName = envConfigPath;

                    Process.Start(psi);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message,
                                "Unable to edit powerdelivery script",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
コード例 #2
0
        protected void btnBuild_Click(object sender, RoutedEventArgs e)
        {
            Button btnSource = (Button)sender;

            DeliveryPipeline pipeline = btnSource.DataContext as DeliveryPipeline;

            try
            {
                string localDirectory = pipeline.GetWorkingDirectory();

                if (localDirectory != null)
                {
                    string scriptName = string.Format("{0}.ps1", pipeline.ScriptName);

                    string scriptPath = string.Format("{0}\\{1}", localDirectory, scriptName);

                    if (!File.Exists(scriptPath))
                    {
                        throw new Exception(string.Format("File:\n\n{0}\n\nCouldn't be found on disk. Did you move your working folder?", scriptPath));
                    }

                    InvokePowerDeliveryCommand command = new InvokePowerDeliveryCommand();

                    command.ScriptName = scriptName;

                    try
                    {
                        command.BuildCommand();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Correct invalid entries", MessageBoxButton.OK, MessageBoxImage.Error);

                        return;
                    }

                    NavigationService _navService = NavigationService;

                    _navService.Navigate(new RunPowerShell(this, "Running local build", command, localDirectory,
                                                           () => { ClientConfiguration.Current.RefreshSources(); _navService.Navigate(new Home(_clientControl)); return(true); },
                                                           () => { _navService.Navigate(new Home(_clientControl));  return(true); }
                                                           ));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message,
                                string.Format("Unable to run {0}.ps1", pipeline.ScriptName),
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
コード例 #3
0
        private void btnEditPipelineEnvironment_Click(object sender, RoutedEventArgs e)
        {
            Button btnSource = (Button)sender;

            DeliveryPipeline pipeline = (DeliveryPipeline)btnSource.DataContext;

            try
            {
                string localDirectory = pipeline.GetWorkingDirectory();

                if (localDirectory != null)
                {
                    string envConfigPath = string.Format("{0}\\{1}Shared.yml", localDirectory, pipeline.ScriptName);

                    if (!File.Exists(envConfigPath))
                    {
                        throw new Exception(string.Format("File:\n\n{0}\n\nCouldn't be found on disk. Did you move your working folder?", envConfigPath));
                    }

                    try
                    {
                        ProcessStartInfo psi = new ProcessStartInfo();
                        psi.FileName         = envConfigPath;
                        psi.WorkingDirectory = System.IO.Path.GetDirectoryName(envConfigPath);

                        Process.Start(psi);
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(string.Format("Unable to edit configuration file:\n\n{0}\n\n{1}", envConfigPath, ex.Message));
                    }
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message,
                                "Unable to edit shared environment configuration file",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }