private static bool NotifyOfReplacement(TacticReplaceStatus t) { if (_status == null) { return(false); } switch (t) { case TacticReplaceStatus.NoDocumentPersistence: _status.SetText("Document must be saved in order to expand tactics."); break; case TacticReplaceStatus.TranslatorFail: _status.SetText("Tacny was unable to expand requested tactics."); break; case TacticReplaceStatus.NotResolved: _status.SetText("File must first be resolvable to expand tactics."); break; case TacticReplaceStatus.NoTactic: _status.SetText("There is no method under the caret that has expandable tactics."); break; case TacticReplaceStatus.Success: _status.SetText("Tactic expanded succesfully."); break; default: throw new Exception("Escaped Switch with " + t); } return(true); }
private void PrepareStatusbar(out object icon) { icon = (short)InteropConstants.SBAI_Save; var tmpIcon = icon; ThreadHelper.JoinableTaskFactory.Run(async() => { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); // You're now on the UI thread. try { _statusBar.IsFrozen(out var frozen); if (frozen != 0) { return; } _statusBar.SetText("Rendering template..."); _statusBar.Animation(1, ref tmpIcon); } catch (Exception exception) { Log.Debug("Failed to prepare statusbar: {0}", exception.Message); } }); }
public override void StartProgressMessage(string message) { // stock general animation icon object icon = (short)Microsoft.VisualStudio.Shell.Interop.Constants.SBAI_General; try { // Make sure the status bar is not frozen int frozen; _statusBar.IsFrozen(out frozen); if (frozen != 0) { _statusBar.FreezeOutput(0); } _statusBar.SetText(message); // start icon animation _statusBar.Animation(1, ref icon); } catch (InvalidOperationException) { } }
private void OnTimer(object sender, EventArgs e) { try { Debug.Assert(!_vimApplicationSettings.UseEditorCommandMargin); var vimBuffer = _vim.FocusedBuffer.SomeOrDefault(null); var status = vimBuffer != null ? _commandMarginUtil.GetStatus(vimBuffer).Text : ""; if (status.Length == 0) { if (VSConstants.S_OK == _vsStatusbar.GetText(out var currentText) && StringComparer.Ordinal.Equals(currentText, _lastStatus)) { _vsStatusbar.SetText(" "); } _lastStatus = null; } else { _lastStatus = status; _vsStatusbar.SetText(status); } } catch (Exception ex) { _vimProtectedOperations.Report(ex); } }
private void ShowActionStateInStatusBar(object sender, ActionExecutionStateChangedEventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); if (_statusBar == null) { _statusBar = (IVsStatusbar)_serviceProvider.GetService(typeof(SVsStatusbar)); } _statusBar.FreezeOutput(0); switch (e.State) { case ActionExecutionState.Started: _statusBar.SetText("Running " + e.ActionName + " action..."); break; case ActionExecutionState.Finished: _statusBar.SetText("Finished running " + e.ActionName + " action"); break; case ActionExecutionState.Cancelling: _statusBar.SetText("Cancelling " + e.ActionName + " action..."); break; } _statusBar.FreezeOutput(1); }
private async void CreateProjectAndHandleErrors( IVsStatusbar statusBar, Microsoft.PythonTools.Project.ImportWizard.ImportWizard dlg ) { try { var path = await dlg.ImportSettings.CreateRequestedProjectAsync(); if (File.Exists(path)) { object outRef = null, pathRef = ProcessOutput.QuoteSingleArgument(path); _serviceProvider.GetDTE().Commands.Raise( VSConstants.GUID_VSStandardCommandSet97.ToString("B"), (int)VSConstants.VSStd97CmdID.OpenProject, ref pathRef, ref outRef ); statusBar.SetText(""); return; } } catch (UnauthorizedAccessException) { MessageBox.Show(Strings.ErrorImportWizardUnauthorizedAccess, Strings.ProductTitle); } catch (Exception ex) { ActivityLog.LogError(Strings.ProductTitle, ex.ToString()); MessageBox.Show(Strings.ErrorImportWizardException.FormatUI(ex.GetType().Name), Strings.ProductTitle); } statusBar.SetText(Strings.StatusImportWizardError); }
private async Task<bool> SendToRemoteWorkerAsync(IEnumerable<string> files, string projectDir, string projectName, string remotePath, IVsStatusbar statusBar, CancellationToken cancellationToken) { await TaskUtilities.SwitchToBackgroundThread(); string currentStatusText; statusBar.GetText(out currentStatusText); var workflow = _interactiveWorkflowProvider.GetOrCreate(); var outputWindow = workflow.ActiveWindow.InteractiveWindow; uint cookie = 0; try { var session = workflow.RSession; statusBar.SetText(Resources.Info_CompressingFiles); statusBar.Progress(ref cookie, 1, "", 0, 0); int count = 0; uint total = (uint)files.Count() * 2; // for compressing and sending string compressedFilePath = string.Empty; await Task.Run(() => { compressedFilePath = _fs.CompressFiles(files, projectDir, new Progress<string>((p) => { Interlocked.Increment(ref count); statusBar.Progress(ref cookie, 1, string.Format(Resources.Info_CompressingFile, Path.GetFileName(p)), (uint)count, total); string dest = p.MakeRelativePath(projectDir).ProjectRelativePathToRemoteProjectPath(remotePath, projectName); _appShell.DispatchOnUIThread(() => { outputWindow.WriteLine(string.Format(Resources.Info_LocalFilePath, p)); outputWindow.WriteLine(string.Format(Resources.Info_RemoteFilePath, dest)); }); }), CancellationToken.None); statusBar.Progress(ref cookie, 0, "", 0, 0); }); using (var fts = new DataTransferSession(session, _fs)) { cookie = 0; statusBar.SetText(Resources.Info_TransferringFiles); total = (uint)_fs.FileSize(compressedFilePath); var remoteFile = await fts.SendFileAsync(compressedFilePath, true, new Progress<long>((b) => { statusBar.Progress(ref cookie, 1, Resources.Info_TransferringFiles, (uint)b, total); }), cancellationToken); statusBar.SetText(Resources.Info_ExtractingFilesInRHost); await session.EvaluateAsync<string>($"rtvs:::save_to_project_folder({remoteFile.Id}, {projectName.ToRStringLiteral()}, '{remotePath.ToRPath()}')", REvaluationKind.Normal, cancellationToken); _appShell.DispatchOnUIThread(() => { outputWindow.WriteLine(Resources.Info_TransferringFilesDone); }); } } catch(Exception ex) when (ex is UnauthorizedAccessException || ex is IOException) { _appShell.ShowErrorMessage(Resources.Error_CannotTransferFile.FormatInvariant(ex.Message)); } catch (RHostDisconnectedException rhdex) { _appShell.DispatchOnUIThread(() => { outputWindow.WriteErrorLine(Resources.Error_CannotTransferNoRSession.FormatInvariant(rhdex.Message)); }); } finally { statusBar.Progress(ref cookie, 0, "", 0, 0); statusBar.SetText(currentStatusText); } return true; }
public static void StartProgressMessage(string message) { ThreadHelper.JoinableTaskFactory.RunAsync(async() => { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); // stock general animation icon object icon = (short)Constants.SBAI_General; // Make sure the status bar is not frozen int frozen; _statusBar.IsFrozen(out frozen); if (frozen != 0) { _statusBar.FreezeOutput(0); } _statusBar.SetText(message); // start icon animation _statusBar.Animation(1, ref icon); }); }
private void MenuItemClick(object sender, EventArgs e) { try { uint cookie = 0; _statusBar.Progress(ref cookie, 1, "", 0, 0); _statusBar.Animation(1, ref _sortIcon); var selectedResxFilePaths = GetSelectedResxFilePaths().ToList(); for (var i = 0; i < selectedResxFilePaths.Count; i++) { _resxSorter. Sort(XDocument.Load(selectedResxFilePaths[i])). Save(selectedResxFilePaths[i]); _statusBar.Progress(ref cookie, 1, "", (uint)i + 1, (uint)selectedResxFilePaths.Count); _statusBar.SetText(string.Format("Sorting {0} out of {1} resx files...", i + 1, selectedResxFilePaths.Count)); } WriteToOutput(string.Join(Environment.NewLine, new[] { string.Format("Sorted {0} resx files:", selectedResxFilePaths.Count()) }.Concat( selectedResxFilePaths))); _statusBar.Progress(ref cookie, 0, "", 0, 0); _statusBar.Animation(0, ref _sortIcon); SetStatusBar("Resx sort succeeded"); } catch (Exception exception) { WriteToOutput("Failed to sort resx files: {0}", exception.Message); SetStatusBar("Failed to sort resx files"); } }
private async void CreateProjectAndHandleErrors( IVsStatusbar statusBar, Microsoft.PythonTools.Project.ImportWizard.ImportWizard dlg, bool addToExistingSolution ) { try { var path = await dlg.ImportSettings.CreateRequestedProjectAsync(); if (File.Exists(path)) { object outRef = null, pathRef = ProcessOutput.QuoteSingleArgument(path); _serviceProvider.GetDTE().Commands.Raise( VSConstants.GUID_VSStandardCommandSet97.ToString("B"), addToExistingSolution ? (int)VSConstants.VSStd97CmdID.AddExistingProject : (int)VSConstants.VSStd97CmdID.OpenProject, ref pathRef, ref outRef ); statusBar.SetText(""); return; } } catch (UnauthorizedAccessException) { MessageBox.Show(Strings.ErrorImportWizardUnauthorizedAccess, Strings.ProductTitle); } catch (Exception ex) { ActivityLog.LogError(Strings.ProductTitle, ex.ToString()); MessageBox.Show(Strings.ErrorImportWizardException.FormatUI(ex.GetType().Name), Strings.ProductTitle); } statusBar.SetText(Strings.StatusImportWizardError); }
public void ShowMessage(string message) { if (!IsFrozen()) { VSShellHelper.SetWaitCursor(this.serviceProvider); ErrorHandler.ThrowOnFailure(statusBar.SetText(message)); } }
private void ShowIndterminateProgress(string displayText) { // Display the animated Visual Studio icon in the Animation region. if (_animationIcon == null) { _animationIcon = (short)Constants.SBAI_Find; _statusBar.Animation(1, ref _animationIcon); } _statusBar.SetText(displayText); }
private void PipExtensionProvider_OperationStarted(object sender, ValueEventArgs <string> e) { _outputWindow.WriteLine(e.Value); if (_statusBar != null) { _statusBar.SetText(e.Value); } if (_pyService.GeneralOptions.ShowOutputWindowForPackageInstallation) { _outputWindow.ShowAndActivate(); } }
private void RemoveLicenseHeadersFromAllFiles(object obj) { var removeAllLicenseHeadersCommand = new RemoveLicenseHeaderFromAllFilesInProjectCommand(_licenseReplacer); IVsStatusbar statusBar = (IVsStatusbar)GetService(typeof(SVsStatusbar)); statusBar.SetText(Resources.UpdatingFiles); removeAllLicenseHeadersCommand.Execute(obj); statusBar.SetText(String.Empty); }
/// <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> public void MenuItemCallback(object sender, EventArgs e) { IVsStatusbar statusBar = (IVsStatusbar)ServiceProvider.GetService(typeof(SVsStatusbar)); uint cookie = 0; string label = "SILVERPROD Best practis analysing"; object icon = (short)Microsoft.VisualStudio.Shell.Interop.Constants.SBAI_Build; // Display the icon in the Animation region. statusBar.Animation(1, ref icon); statusBar.SetText(label); statusBar.Progress(ref cookie, 1, label, 5, 10); DTE dte = Package.GetGlobalService(typeof(SDTE)) as DTE; Project activeProject = null; Array activeSolutionProjects = GetActiveProject(dte); Boolean error = false; String Spd = Properties.ModelList.Default["Trigramme"].ToString(); if (activeSolutionProjects != null && activeSolutionProjects.Length > 0) { activeProject = activeSolutionProjects.GetValue(0) as Project; errorListProvider.Tasks.Clear(); SPD spd = new SPD(); spd.ShowDialog(); error = AnalyserRules.TryByProjectItem(activeProject.ProjectItems, errorListProvider, Spd, dte, activeProject.FullName); errorListProvider.Show(); TeamServeceConnect.getListWorkitem(TeamServeceConnect.getURI(dte.Solution.FullName)); if (!error) { if (TeamServeceConnect.getURI(dte.Solution.FullName) != "") { string _ret = "The solution is not configured with DevOps/VSTS"; AnalyserRules.addMessageErrorList(dte, errorListProvider, _ret, dte.Solution.FullName, "", 0, 0); } if (TeamServeceConnect.getListTeamProjects(dte.Solution.FullName).Contains(activeProject.FullName.Split('\\')[activeProject.FullName.Split('\\').Length - 1].Replace(".rnrproj", ""))) { System.Windows.Forms.MessageBox.Show("true"); } System.Windows.Forms.MessageBox.Show(TeamServeceConnect.getListTeamProjects(dte.Solution.FullName)[TeamServeceConnect.getListTeamProjects(dte.Solution.FullName).IndexOf(activeProject.FullName.Split('\\')[activeProject.FullName.Split('\\').Length - 1].Replace(".rnrproj", ""))].ToString()); } } label = "SILVERPROD Best practis analysed"; statusBar.Progress(ref cookie, 0, "", 0, 0); statusBar.SetText(label); }
/// <summary> /// Update status bar. /// </summary> /// <param name="message"></param> private void UpdateStatusBar(string message) { ThreadHelper.ThrowIfNotOnUIThread(); IVsStatusbar statusBar = (IVsStatusbar)ServiceProvider.GetService(typeof(SVsStatusbar)); Assumes.Present(statusBar); // Make sure the status bar is not frozen statusBar.IsFrozen(out int frozen); if (frozen != 0) { statusBar.FreezeOutput(0); } // Set the status bar text and make its display static. statusBar.SetText(message); // Freeze the status bar. statusBar.FreezeOutput(1); // Clear the status bar text. statusBar.FreezeOutput(0); statusBar.Clear(); }
public static void Text(string aText, int aFreezeStatusBar) { DispatcherHandler.BeginInvoke(() => { // Make sure the status bar is not frozen if (VSConstants.S_OK != mStatusBar.IsFrozen(out int frozen)) { return; } if (0 != frozen) { mStatusBar.FreezeOutput(0); } // Set the status bar text mStatusBar.SetText(aText); // Freeze the status bar. mStatusBar.FreezeOutput(aFreezeStatusBar); // Clear the status bar text. if (0 == aFreezeStatusBar) { mStatusBar.Clear(); } }); }
private async Task RMarkdownRenderAsync(IRSession session, string inputFilePath, string outputFilePath, string format, int codePage, IServiceContainer services) { using (var fts = new DataTransferSession(session, services.FileSystem())) { string currentStatusText = string.Empty; uint cookie = 0; IVsStatusbar statusBar = null; services.MainThread().Post(() => { statusBar = services.GetService <IVsStatusbar>(typeof(SVsStatusbar)); statusBar.GetText(out currentStatusText); statusBar.Progress(ref cookie, 1, "", 0, 0); }); try { // TODO: progress and cancellation handling services.MainThread().Post(() => { statusBar?.Progress(ref cookie, 1, Resources.Info_MarkdownSendingInputFile.FormatInvariant(Path.GetFileName(inputFilePath)), 0, 3); }); var rmd = await fts.SendFileAsync(inputFilePath, true, null, CancellationToken.None); services.MainThread().Post(() => { statusBar?.Progress(ref cookie, 1, Resources.Info_MarkdownPublishingFile.FormatInvariant(Path.GetFileName(inputFilePath)), 1, 3); }); var publishResult = await session.EvaluateAsync <ulong>($"rtvs:::rmarkdown_publish(blob_id = {rmd.Id}, output_format = {format.ToRStringLiteral()}, encoding = 'cp{codePage}')", REvaluationKind.Normal); services.MainThread().Post(() => { statusBar?.Progress(ref cookie, 1, Resources.Info_MarkdownGetOutputFile.FormatInvariant(Path.GetFileName(outputFilePath)), 2, 3); }); await fts.FetchFileAsync(new RBlobInfo(publishResult), outputFilePath, true, null, CancellationToken.None); services.MainThread().Post(() => { statusBar?.Progress(ref cookie, 1, Resources.Info_MarkdownPublishComplete.FormatInvariant(Path.GetFileName(outputFilePath)), 3, 3); }); } finally { services.MainThread().Post(() => { statusBar?.Progress(ref cookie, 0, "", 0, 0); statusBar?.SetText(currentStatusText); }); } } }
static public void Run(IServiceProvider serviceProvider, IVsStatusbar statusbar) { var dte = (DTE2)serviceProvider.GetService(typeof(DTE)); var projects = dte.Solution.Projects; uint cookie = 0; object icon = (short)Microsoft.VisualStudio.Shell.Interop.Constants.SBAI_Build; // Initialize the progress bar. statusbar.Progress(ref cookie, 1, "", 0, 0); statusbar.Animation(1, ref icon); for (uint i = 1, n = (uint)projects.Count; i <= n; ++i) { var project = projects.Item(i); statusbar.Progress(ref cookie, 1, "", i + 1, n); statusbar.SetText(string.Format("Converting {0}", project.Name)); ProjectConverter.Run(serviceProvider, project); } // Clear the progress bar. statusbar.Animation(0, ref icon); statusbar.Progress(ref cookie, 0, "", 0, 0); statusbar.FreezeOutput(0); statusbar.Clear(); }
public StatusBarProgressTask(TextWriter writer, string task, IVsStatusbar statusBar) : base(writer, task) { _statusBar = statusBar; _statusBar.SetText(task); }
/// <inheritdoc/> public async Task Clone( string cloneUrl, string clonePath, bool recurseSubmodules, object progress = null) { #if TEAMEXPLORER14 var gitExt = serviceProvider.GetService <IGitRepositoriesExt>(); gitExt.Clone(cloneUrl, clonePath, recurseSubmodules ? CloneOptions.RecurseSubmodule : CloneOptions.None); // The operation will have completed when CanClone goes false and then true again. await gitExt.WhenAnyValue(x => x.CanClone).Where(x => !x).Take(1); await gitExt.WhenAnyValue(x => x.CanClone).Where(x => x).Take(1); #else var gitExt = serviceProvider.GetService <IGitActionsExt>(); var typedProgress = ((Progress <Microsoft.VisualStudio.Shell.ServiceProgressData>)progress) ?? new Progress <Microsoft.VisualStudio.Shell.ServiceProgressData>(); await Microsoft.VisualStudio.Shell.ThreadHelper.JoinableTaskFactory.RunAsync(async() => { typedProgress.ProgressChanged += (s, e) => statusBar.SetText(e.ProgressText); await gitExt.CloneAsync(cloneUrl, clonePath, recurseSubmodules, default(CancellationToken), typedProgress); }); #endif }
public StatusBarUpdater(IVsStatusbar statusBar, IThreadingContext threadingContext, string?projectOrSolutionName, uint totalProjectCount) { Contract.ThrowIfFalse(threadingContext.HasMainThread); _statusBar = statusBar; _threadingContext = threadingContext; _totalProjectCount = totalProjectCount; _statusMessageWhileRunning = projectOrSolutionName != null ? string.Format(ServicesVSResources.Running_code_analysis_for_0, projectOrSolutionName) : ServicesVSResources.Running_code_analysis_for_Solution; _statusMesageOnCompleted = projectOrSolutionName != null ? string.Format(ServicesVSResources.Code_analysis_completed_for_0, projectOrSolutionName) : ServicesVSResources.Code_analysis_completed_for_Solution; _statusMesageOnTerminated = projectOrSolutionName != null ? string.Format(ServicesVSResources.Code_analysis_terminated_before_completion_for_0, projectOrSolutionName) : ServicesVSResources.Code_analysis_terminated_before_completion_for_Solution; // Set the initial status bar progress and text. _statusBar.Progress(ref _statusBarCookie, fInProgress: 1, _statusMessageWhileRunning, nComplete: 0, nTotal: totalProjectCount); _statusBar.SetText(_statusMessageWhileRunning); // Create a timer to periodically update the status message while running analysis. _timer = new Timer(new TimerCallback(UpdateStatusOnTimer), new AutoResetEvent(false), dueTime: TimeSpan.FromSeconds(5), period: TimeSpan.FromSeconds(5)); }
public override void SetText(string text) { Assert.ArgumentNotNull(text, nameof(text)); IVsStatusbar statusBar = null; ThreadHelper.JoinableTaskFactory.Run(async delegate { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); statusBar = SitecorePackage.Instance.GetService <SVsStatusbar>() as IVsStatusbar; }); if (statusBar == null) { return; } int frozen; statusBar.IsFrozen(out frozen); if (frozen == 0) { statusBar.SetText(text); } }
private void UpdateStatusCore() { _threadingContext.JoinableTaskFactory.RunAsync(async() => { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(); string message; int fInProgress; var analyzedProjectCount = (uint)_analyzedProjectCount; if (analyzedProjectCount == _totalProjectCount) { message = _statusMesageOnCompleted; fInProgress = 0; } else if (_disposed) { message = _statusMesageOnTerminated; fInProgress = 0; } else { message = _statusMessageWhileRunning; fInProgress = 1; } // Update the status bar progress and text. _statusBar.Progress(ref _statusBarCookie, fInProgress, message, analyzedProjectCount, _totalProjectCount); _statusBar.SetText(message); }); }
/// <summary> /// Override this method to define the async command body te execute on the /// background thread /// </summary> protected override async Task ExecuteAsync() { IVsStatusbar statusBar = (IVsStatusbar)await SpectNetPackage.Default.GetServiceAsync(typeof(SVsStatusbar)); statusBar.IsFrozen(out int frozen); if (frozen != 0) { statusBar.FreezeOutput(0); } statusBar.SetText("Building ZX Spectrum code"); statusBar.FreezeOutput(1); object icon = (short)Constants.SBAI_Build; statusBar.Animation(1, ref icon); try { CompileSuccess = await Task.Run(() => CompileCode()); } catch (Exception ex) { CompileException = ex; } finally { statusBar.FreezeOutput(0); statusBar.Animation(0, ref icon); statusBar.Clear(); } }
public PublishProject(CommonProjectNode node, PublishProjectOptions options) { _statusBar = (IVsStatusbar)CommonPackage.GetGlobalService(typeof(SVsStatusbar)); _statusBar.SetText("Starting publish..."); _node = node; _options = options; }
private async Task RMarkdownRenderAsync(IRSession session, IFileSystem fs, string inputFilePath, string outputFilePath, string format, int codePage, IApplicationShell appShell) { using (var fts = new DataTransferSession(session, fs)) { string currentStatusText = string.Empty; uint cookie = 0; IVsStatusbar statusBar = null; appShell.DispatchOnUIThread(() => { statusBar = appShell.GetGlobalService <IVsStatusbar>(typeof(SVsStatusbar)); statusBar.GetText(out currentStatusText); statusBar.Progress(ref cookie, 1, "", 0, 0); }); try { appShell.DispatchOnUIThread(() => { statusBar?.Progress(ref cookie, 1, Resources.Info_MarkdownSendingInputFile.FormatInvariant(Path.GetFileName(inputFilePath)), 0, 3); }); var rmd = await fts.SendFileAsync(inputFilePath); appShell.DispatchOnUIThread(() => { statusBar?.Progress(ref cookie, 1, Resources.Info_MarkdownPublishingFile.FormatInvariant(Path.GetFileName(inputFilePath)), 1, 3); }); var publishResult = await session.EvaluateAsync <ulong>($"rtvs:::rmarkdown_publish(blob_id = {rmd.Id}, output_format = {format.ToRStringLiteral()}, encoding = 'cp{codePage}')", REvaluationKind.Normal); appShell.DispatchOnUIThread(() => { statusBar?.Progress(ref cookie, 1, Resources.Info_MarkdownGetOutputFile.FormatInvariant(Path.GetFileName(outputFilePath)), 2, 3); }); await fts.FetchFileAsync(new RBlobInfo(publishResult), outputFilePath); appShell.DispatchOnUIThread(() => { statusBar?.Progress(ref cookie, 1, Resources.Info_MarkdownPublishComplete.FormatInvariant(Path.GetFileName(outputFilePath)), 3, 3); }); } finally { appShell.DispatchOnUIThread(() => { statusBar?.Progress(ref cookie, 0, "", 0, 0); statusBar?.SetText(currentStatusText); }); } } }
public PublishProject(CommonProjectNode node, PublishProjectOptions options) { _statusBar = (IVsStatusbar)node.Site.GetService(typeof(SVsStatusbar)); _statusBar.SetText("Starting publish..."); _node = node; _options = options; }
private void StartIntelliSense(int lineStartPosition, int caretPosition, string lineTextUpToCaret) { Interlocked.Increment(ref _triggerTag); if (_statusBar != null) { _statusBar.SetText("Running IntelliSense..."); } _sw.Restart(); // Procedures for correctly supporting IntelliSense in REPL window. // Step 1, determine if this is REPL windows IntelliSense. If no, continue with normal IntelliSense triggering process. Otherwise, continue with the following steps. // Step 2, map the caret position in current REPL window text buffer to the one in current POWERSHELL text buffer. // Step 3, get the current POWERSHELL text. // Step 4, get the command completion results using the script text from Step 3 and the mapped caret position from Step 2. string script = String.Empty; int scriptParsePosition = 0; _replacementIndexOffset = 0; // This index offset is to caculate the existing text length minus the powershell code users are editing of Repl window. if (_textView.TextBuffer.ContentType.TypeName.Equals(PowerShellConstants.LanguageName, StringComparison.Ordinal)) { script = _textView.TextBuffer.CurrentSnapshot.GetText(); scriptParsePosition = caretPosition; } else if (_textView.TextBuffer.ContentType.TypeName.Equals(ReplConstants.ReplContentTypeName, StringComparison.Ordinal)) { var currentActiveReplBuffer = _textView.BufferGraph.GetTextBuffers(p => p.ContentType.TypeName.Equals(PowerShellConstants.LanguageName, StringComparison.Ordinal)) .LastOrDefault(); var currentBufferPoint = _textView.BufferGraph.MapDownToBuffer(_textView.Caret.Position.BufferPosition, PointTrackingMode.Positive, currentActiveReplBuffer, PositionAffinity.Successor); scriptParsePosition = currentBufferPoint.Value.Position; script = currentActiveReplBuffer.CurrentSnapshot.GetText(); _replacementIndexOffset = _textView.TextBuffer.CurrentSnapshot.GetText().Length - script.Length; } else { Log.Error("The content type of the text buffer isn't recognized."); return; } // Go out-of-proc here to get the completion list PowerShellToolsPackage.IntelliSenseService.RequestCompletionResults(script, scriptParsePosition, _currentActiveWindowId, _triggerTag); }
public void SetText(string text) { _statusBar.IsFrozen(out int frozen); if (frozen == 0) { _statusBar.SetText(text); } }
private async Task UpdateModelAsync(bool force) { _statusBar.SetText(LocalizedStrings.RefreshingPlatforms); // using a local here to capture ViewModel on the UI thread var viewModel = ViewModel; await viewModel.UpdateAsync(force : force).ConfigureAwait(false); if (viewModel.HasError) { _statusBar.SetText(viewModel.ErrorMessage); } else { _statusBar.SetText(LocalizedStrings.RefreshingPlatformsComplete); } }
private void RemoveLicenseHeadersFromAllFiles(object obj) { var removeAllLicenseHeadersCommand = new RemoveLicenseHeaderFromAllFilesInProjectCommand(_licenseReplacer); var task = GetServiceAsync(typeof(SVsStatusbar)); task.ContinueWith(t => { IVsStatusbar statusBar = (IVsStatusbar)t.Result; statusBar.SetText(Resources.UpdatingFiles); removeAllLicenseHeadersCommand.Execute(obj); statusBar.SetText(String.Empty); }); task.Start(); }
private void SetText(string text) { ThreadHelper.JoinableTaskFactory.Run(() => { _statusbar.SetText(text); return(Task.CompletedTask); }); }
/// <summary> /// Get all library archives accessible to the linker of the specified project. /// </summary> /// <param name="project">The project to get the LibArchives for</param> /// <param name="statusBar">the VS status bar</param> /// <returns>Parsed libraries which are accessible by the linker of the given project.</returns> public List<LibArchive> GetLibraryArchives(Project project, IVsStatusbar statusBar) { int frozen; uint cookie = 0; statusBar.IsFrozen(out frozen); if (!_projectArchiveMap.ContainsKey(project)) { var archives = new List<LibArchive>(); var libraries = GetLibraries(project); if (frozen == 0) statusBar.Progress(ref cookie, 1, "", 0, (uint)libraries.Count); int i = 0; foreach(var lib in libraries) { if (frozen == 0) { statusBar.Progress(ref cookie, 1, "", (uint) i++, (uint)libraries.Count); statusBar.SetText("Scanning " + Path.GetFileName(lib)); } archives.Add(GetArchive(lib)); } _projectArchiveMap.Add(project, archives); } if (frozen == 0) { statusBar.Progress(ref cookie, 0, "", 0, 0); statusBar.Clear(); } return _projectArchiveMap[project]; }
private static void TrySetTypingsLoadedStatusBar(IVsStatusbar statusBar, object icon, bool statusSetSuccess) { if (statusBar != null && (statusSetSuccess || !IsStatusBarFrozen(statusBar))) { if (!ErrorHandler.Succeeded(statusBar.FreezeOutput(0))) { Debug.Fail("Failed to unfreeze typings status bar"); return; } statusBar.Animation(0, ref icon); statusBar.SetText(Resources.StatusTypingsLoaded); } }
private static bool TrySetTypingsLoadingStatusBar(IVsStatusbar statusBar, object icon) { if (statusBar != null && !IsStatusBarFrozen(statusBar)) { statusBar.SetText(Resources.StatusTypingsLoading); statusBar.Animation(1, ref icon); if (ErrorHandler.Succeeded(statusBar.FreezeOutput(1))) { return true; } Debug.Fail("Failed to freeze typings status bar"); } return false; }