private async void scanProgressUpdated(int filesScanned) { await JoinableTaskFactory.SwitchToMainThreadAsync(); EnvDTE.StatusBar statusBar = _dte.StatusBar; if (statusBar != null) { try { if (filesScanned >= 0) { string label = "cppcheck scanning for files (" + filesScanned + ")"; statusBar.Text = label; } else { statusBar.Clear(); } } catch (Exception ex) { } } }
/// <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) { EnvDTE.StatusBar statusBar = null; try { var config = new PipelineConfiguration(); config.Initialize(dte); if (!config.ShowDialog().Equals(DialogResult.OK)) { return; } statusBar = config.SourceProject.DTE.StatusBar; buildPipeline(config, (curr, total) => /* update lambda */ { if (curr != total) { statusBar.Progress(true, "Generating Pipeline", curr, total); } else { statusBar.Progress(false, "Pipeline Generation Complete", 1, 1); } }); } catch (Exception exception) { showException(exception); if (statusBar != null) { statusBar.Clear(); statusBar.Progress(false, "Problem generating pipeline.", 1, 1); } } }