Exemplo n.º 1
0
        /// <summary>
        /// Shows the tool window when the menu item is clicked.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            _package.JoinableTaskFactory.RunAsync(async() =>
            {
                try
                {
                    var window = await _package.FindToolWindowAsync(typeof(MutationExplorerWindow), 0, true, _package.DisposalToken) as MutationExplorerWindow;

                    if (window?.Frame == null)
                    {
                        throw new NotSupportedException("Cannot create tool window");
                    }

                    await _package.JoinableTaskFactory.SwitchToMainThreadAsync();

                    var windowFrame = (IVsWindowFrame)window.Frame;
                    Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());

                    window.InitializeWindow();
                }
                catch (Exception ex)
                {
                    _userNotificationService.ShowError($"Failed to open config window. Make sure that you have the latest visual studio update. \n Exception: \n {ex.Message}");
                    throw;
                }
            });
        }
 /// <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 Execute(object sender, EventArgs e)
 {
     try
     {
         GetFilesAndRunMutations();
     }
     catch (Exception ex)
     {
         _userNotificationService.ShowError($"Failed to open config window. Make sure that you have the latest visual studio update. \n Exception: \n {ex.Message}");
         throw;
     }
 }
 private void Execute(object sender, EventArgs e)
 {
     try
     {
         var mutationConfigControl = new MutationConfigWindowControl(new MutationConfigWindowViewModel(_environmentService, _solutionInfoService));
         mutationConfigControl.ShowDialog();
     }
     catch (Exception ex)
     {
         _userNotificationService.ShowError($"Failed to open config window. Make sure that you have the latest visual studio update. \n Exception: \n {ex.Message}");
         throw;
     }
 }