internal virtual void ShowErrorMessage(string message) { MessageHelper.ShowErrorMessage(message, VsResources.TemplateWizard_ErrorDialogTitle); }
public void EnableCurrentSolutionForRestore(bool fromActivation) { if (!_solutionManager.IsSolutionOpen) { throw new InvalidOperationException(VsResources.SolutionNotAvailable); } if (fromActivation) { // if not in quiet mode, ask user for confirmation before proceeding bool?result = MessageHelper.ShowQueryMessage( VsResources.PackageRestoreConfirmation, VsResources.DialogTitle, showCancelButton: false); if (result != true) { return; } } Exception exception = null; IVsThreadedWaitDialog2 waitDialog; _waitDialogFactory.CreateInstance(out waitDialog); try { // Start the wait dialog on the UI thread InvokeOnUIThread(() => waitDialog.StartWaitDialog( VsResources.DialogTitle, VsResources.PackageRestoreWaitMessage, String.Empty, varStatusBmpAnim: null, szStatusBarText: null, iDelayToShowDialog: 0, fIsCancelable: false, fShowMarqueeProgress: true)); if (fromActivation) { // only enable package restore consent if this is called as a result of user enabling package restore SetPackageRestoreConsent(); } EnablePackageRestore(fromActivation); } catch (Exception ex) { exception = ex; ExceptionHelper.WriteToActivityLog(exception); } finally { int canceled; InvokeOnUIThread(() => waitDialog.EndWaitDialog(out canceled)); } if (fromActivation) { if (exception != null) { // show error message MessageHelper.ShowErrorMessage( VsResources.PackageRestoreErrorMessage + Environment.NewLine + Environment.NewLine + ExceptionUtility.Unwrap(exception).Message, VsResources.DialogTitle); } else { // show success message MessageHelper.ShowInfoMessage( VsResources.PackageRestoreCompleted, VsResources.DialogTitle); } } }