/// <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) { mCommandsController.Running = true; var task = System.Threading.Tasks.Task.Run(() => { try { AutomationUtil.SaveAllProjects(Package, DTEObj.Solution); CollectSelectedItems(); mFileWatcher = new FileChangerWatcher(); using (var guard = new SilentFileChangerGuard()) { if (mTidyOptions.Fix) { WatchFiles(); SilentFiles(guard); } RunScript(OutputWindowConstants.kTidyCodeCommand, mTidyOptions, mTidyChecks, mTidyCustomChecks); } } catch (Exception exception) { VsShellUtilities.ShowMessageBox(Package, exception.Message, "Error", OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); } }).ContinueWith(tsk => mCommandsController.AfterExecute());; }
/// <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) { mCommandsController.Running = true; var task = System.Threading.Tasks.Task.Run(() => { try { AutomationUtil.SaveAllProjects(Package, DTEObj.Solution); CollectSelectedItems(); RunScript(OutputWindowConstants.kComplileCommand); } catch (Exception exception) { VsShellUtilities.ShowMessageBox(Package, exception.Message, "Error", OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); } }).ContinueWith(tsk => mCommandsController.AfterExecute()); }