private async Task HandleButtonInternalAsync(object solutionObject, MenuItemButtonHandlerImplementation handler, BaseUpdateViewModel solutionUpdateViewModel) { await LicenseHeadersPackage.Instance.JoinableTaskFactory.SwitchToMainThreadAsync(); if (!(solutionObject is Solution solution)) { return; } _cancellationTokenSource = new CancellationTokenSource(); try { await handler.DoWorkAsync(_cancellationTokenSource.Token, solutionUpdateViewModel, solution, _dialog); } catch (OperationCanceledException) { await LicenseHeadersPackage.Instance.JoinableTaskFactory.SwitchToMainThreadAsync(); _dialog.Close(); } catch (Exception ex) { MessageBoxHelper.ShowMessage( $"The operation '{handler.Description}' failed with the exception '{ex.Message}'. See Visual Studio Output Window for Details."); s_log.Error($"The operation '{handler.Description}' failed.", ex); } await LicenseHeadersPackage.Instance.JoinableTaskFactory.SwitchToMainThreadAsync(); _dialog.Close(); }
public SolutionMenuItemButtonHandler(DTE2 dte2, MenuItemButtonOperation mode, MenuItemButtonHandlerImplementation handler) { _dte2 = dte2; Mode = mode; _handler = handler; }
public FolderProjectMenuItemButtonHandler(MenuItemButtonOperation mode, MenuItemButtonLevel level, MenuItemButtonHandlerImplementation handler) { Mode = mode; Level = level; _handler = handler; }