private bool PopDownloadDialog() { return((waitDialog != null) && waitDialog.StartWaitDialogWithPercentageProgress( dialogDesc?.WaitCaption, dialogDesc?.WaitMessage, dialogDesc?.ProgressText, null, dialogDesc?.StatusBarText, true, 0, 100, 0) == VSConstants.S_OK); }
/// <summary> /// Creates the threaded wait dialog, see <b>Microsoft.VisualStudio.Shell.Interop.IVsThreadedWaitDialog2</b> /// </summary> /// <param name="message">The message.</param> /// <param name="progress">The progress.</param> /// <param name="statustext">The statustext.</param> /// <param name="total">The total.</param> /// <returns>"Microsoft.VisualStudio.Shell.Interop.IVsThreadedWaitDialog2" instance</returns> static internal IVsThreadedWaitDialog2 CreateThreadedWaitDialog(string message, string progress, string statustext, int total) { IVsThreadedWaitDialog2 dlg = null; ErrorHandler.ThrowOnFailure(dialogFactory.CreateInstance(out dlg)); ErrorHandler.ThrowOnFailure( dlg.StartWaitDialogWithPercentageProgress(AppTitle, message, progress, null, statustext, true, 0, total, 0)); return(dlg); }
/// <summary> /// Creates the threaded wait dialog, see <b>Microsoft.VisualStudio.Shell.Interop.IVsThreadedWaitDialog2</b> /// </summary> /// <param name="message">The message.</param> /// <param name="progress">The progress.</param> /// <param name="statustext">The statustext.</param> /// <param name="total">The total.</param> /// <returns>"Microsoft.VisualStudio.Shell.Interop.IVsThreadedWaitDialog2" instance</returns> static internal IVsThreadedWaitDialog2 CreateThreadedWaitDialog(string message, string progress, string statustext, int total) { //dlg = Utilities.CreateThreadedWaitDialog("Collecting information about changesets", "Starting to process changests...", "status", 100); //dlg.UpdateProgress("Collecting information about changesets", "Starting to process changesets...", "status", 0, 100, true, out bcanceled); //dlg.EndWaitDialog(out icanceled); IVsThreadedWaitDialog2 dlg = null; ErrorHandler.ThrowOnFailure(dialogFactory.CreateInstance(out dlg)); ErrorHandler.ThrowOnFailure( dlg.StartWaitDialogWithPercentageProgress(AppTitle, message, progress, null, statustext, true, 0, total, 0)); return(dlg); }
internal void Start(string message, string progress, int delayToStart) { Debug.Assert(_dialogStarted == false, "attempting to start running dialog"); if (!_dialogStarted) { if (_supportsPercentage) { ThrowOnFailure( _waitDialog.StartWaitDialogWithPercentageProgress( _caption, message, progress, null, null, _cancelable, delayToStart, 0, 0)); } else { ThrowOnFailure(_waitDialog.StartWaitDialog(_caption, message, progress, null, null, delayToStart, _cancelable, true)); } _dialogStarted = 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 void Execute(object sender, EventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); var dte = _sdteService as DTE; if (dte.SelectedItems.Count <= 0) { return; } var totalCount = _selectedItemCountExecutor.Execute(dte.SelectedItems); IVsThreadedWaitDialog2 dialog = null; if (totalCount > 1 && _dialogFactory != null) { //https://www.visualstudiogeeks.com/extensions/visualstudio/using-progress-dialog-in-visual-studio-extensions _dialogFactory.CreateInstance(out dialog); } var cts = new CancellationTokenSource(); if (dialog == null || dialog.StartWaitDialogWithPercentageProgress("Proto Attributor: Attributing Progress", "", $"0 of {totalCount} Processed", null, DIALOG_ACTION, true, 0, totalCount, 0) != VSConstants.S_OK) { dialog = null; } try { _attributeExecutor.Execute(dte.SelectedItems, cts, dialog, totalCount, _textSelectionExecutor, (content) => _attributeService.ReorderAttributes(content)); } finally { dialog?.EndWaitDialog(out var usercancel); } }
/// <summary> /// Tries to create stash staged (if operatiopn wasn't successful - shows Team Explorer notification). /// </summary> /// <param name="message">message that should be assigned to the Stash.</param> /// <returns>True if operation was successful, otherwise - false.</returns> public bool TryCreateStashStaged(string message) { Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(); IVsThreadedWaitDialog2 dialog = null; if (_dialogFactory != null) { _dialogFactory.CreateInstance(out dialog); } // Step 1. git stash keep staged. if (dialog != null) { dialog.StartWaitDialogWithPercentageProgress("Stash staged", "Step 1: git stash --keep-index", "Waiting...", null, "Waiting", false, 0, 4, 1); } if (!_gitCommandExecuter.TryCreateStashKeepIndex(out var errorMessage)) { dialog?.EndWaitDialog(out _); _teamExplorer.ShowNotification(errorMessage, NotificationType.Error, NotificationFlags.None, null, Guid.NewGuid()); return(false); } // Step 2. git stash if (dialog != null) { dialog.UpdateProgress($"Step 2: git stash save '{message}'", "Waiting...", "Waiting", 2, 4, true, out _); } if (!_gitCommandExecuter.TryCreateStash(message, true, out errorMessage)) { dialog?.EndWaitDialog(out _); _teamExplorer.ShowNotification(errorMessage, NotificationType.Error, NotificationFlags.None, null, Guid.NewGuid()); return(false); } // Step 3. git stash apply if (dialog != null) { dialog.UpdateProgress("Step 3: git stash apply stash@{1}", "Waiting...", "Waiting", 3, 4, true, out _); } if (!_gitCommandExecuter.TryApplyStash(1, out errorMessage)) { dialog?.EndWaitDialog(out _); _teamExplorer.ShowNotification(errorMessage, NotificationType.Error, NotificationFlags.None, null, Guid.NewGuid()); return(false); } // Step 4. git stash drop if (dialog != null) { dialog.UpdateProgress("Step 4: git stash drop stash@{1}", "Waiting...", "Waiting", 4, 4, true, out _); } if (!_gitCommandExecuter.TryDeleteStash(1, out errorMessage)) { dialog?.EndWaitDialog(out _); _teamExplorer.ShowNotification(errorMessage, NotificationType.Error, NotificationFlags.None, null, Guid.NewGuid()); return(false); } dialog?.EndWaitDialog(out _); return(true); }