示例#1
0
 private void PublishingChain()
 {
     if (ChangesDialog() == true)
     {
         var versionSelector = new PublishUI.PublisherVersionSelectionDialog();
         if (versionSelector.ShowSelectionDialog(ItemBeingPublished) == DialogResult.OK)
         {
             GenerateUpdateConfig(versionSelector.SelectedVersion);
             string scriptFile = GenerateTemporaryBatchScript(ItemBeingPublished.Details.PublishScriptCode);
             RunScript(scriptFile);
             DeploymentDialog deploymentDialog = new DeploymentDialog();
             deploymentDialog.ShowConfigDialog(ItemBeingPublished);
             deploymentDialog.ShowDialog();
             Environment.Exit(0);
         }
         else
         {
             Environment.Exit(0);
         }
     }
     else
     {
         Environment.Exit(0);
     }
 }
示例#2
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            string message     = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName);
            string title       = "DeploymentCommand";
            DTE    dte         = (DTE)ServiceProvider.GetService(typeof(DTE));
            string solutionDir = System.IO.Path.GetDirectoryName(dte.Solution.FullName);

            IntPtr             hierarchyPointer, selectionContainerPointer;
            Object             selectedObject = null;
            IVsMultiItemSelect multiItemSelect;
            uint projectItemId;

            IVsMonitorSelection monitorSelection =
                (IVsMonitorSelection)Package.GetGlobalService(
                    typeof(SVsShellMonitorSelection));

            monitorSelection.GetCurrentSelection(out hierarchyPointer,
                                                 out projectItemId,
                                                 out multiItemSelect,
                                                 out selectionContainerPointer);

            IVsHierarchy selectedHierarchy = Marshal.GetTypedObjectForIUnknown(
                hierarchyPointer,
                typeof(IVsHierarchy)) as IVsHierarchy;

            if (selectedHierarchy != null)
            {
                ErrorHandler.ThrowOnFailure(selectedHierarchy.GetProperty(
                                                projectItemId,
                                                (int)__VSHPROPID.VSHPROPID_ExtObject,
                                                out selectedObject));
            }

            Project selectedProject = selectedObject as Project;

            string       projectPath = Path.GetDirectoryName(selectedProject.FullName);
            ConfigReader reader      = new ConfigReader(projectPath, new OutputLog());

            DeploymentDialog testDialog = new DeploymentDialog();

            testDialog.DataContext = new DeploymentDialogViewModel(reader, projectPath);
            testDialog.ShowDialog();


            // Show a message box to prove we were here
            //VsShellUtilities.ShowMessageBox(
            //    this.ServiceProvider,
            //    message,
            //    title,
            //    OLEMSGICON.OLEMSGICON_INFO,
            //    OLEMSGBUTTON.OLEMSGBUTTON_OK,
            //    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
        }
        private void ScaleDeployment(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;

            if (item != null)
            {
                KubernetesViewModel kbModel = (KubernetesViewModel)DataContext;
                var dialog = new DeploymentDialog(kbModel.SelectedKubernetesDeployment);

                if (dialog.ShowDialog() == true)
                {
                    kbModel.ScaleDeployment(kbModel.SelectedKubernetesDeployment.Metadata.Name, dialog.NumberOfReplicas);
                }

                e.Handled = true;
            }
        }
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private async void Execute(object sender, EventArgs e)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            _isProcessRunning = true;


            var dialog = new DeploymentDialog(_deployment.GetDeploymentInfo(_package));

            if (dialog.ShowDialog() == true)
            {
                _package.SetStatusBarText("Scaling Deploymnet...");
                _deployment.ScaleDeployment(_package, dialog.NumberOfReplicas);
                _package.SetStatusBarText("Scaling complete...");
            }

            _package.SetStatusBarText("");
            _isProcessRunning = false;
        }
示例#5
0
        private bool ChangesDialog()
        {
            var result = MessageBox.Show("Would You Like to Make Edits to the Config Before Publishing", "Make Edits?", MessageBoxButtons.YesNoCancel);

            if (result == DialogResult.Yes)
            {
                string           id     = ItemBeingPublished.Details.ID;
                DeploymentDialog editor = new DeploymentDialog();
                editor.ShowConfigDialog(ItemBeingPublished);
                editor.ShowDialog();
                DataModel.GetUpdateAssistants();
                ItemBeingPublished = DataModel.Assistants.FirstOrDefault(x => x.Details.ID == id);
                return(ChangesDialog());
            }
            else if (result == DialogResult.Cancel)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }