Ejemplo n.º 1
0
        private void btnDeletePipeline_Click(object sender, RoutedEventArgs e)
        {
            DeliveryPipeline pipeline = ((Button)sender).DataContext as DeliveryPipeline;

            if (MessageBox.Show(string.Format("Are you sure you want to remove pipeline \"{0}\"\r\nfrom \"{1}\"?", pipeline.ScriptName, pipeline.ProjectName),
                                "Confirm remove pipeline", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                DeletePipelineCommand command = new DeletePipelineCommand();
                command.Name          = pipeline.ScriptName;
                command.CollectionURL = pipeline.Source.Uri;
                command.ProjectName   = pipeline.ProjectName;

                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, "Removing pipeline", command, null,
                                                       () => { ClientConfiguration.Current.RefreshSources(); _navService.Navigate(new Home(_clientControl)); return(true); },
                                                       () => { _navService.Navigate(new Home(_clientControl));  return(true); }
                                                       ));
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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);
            }
        }