src/vs-package/LaunchNeoDebugger.cs
/// <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>
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.
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 .
private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var dte = ServiceProvider.GetService<SDTE, DTE2>();
            var launchConfigs = GetLaunchJsonFiles(dte.Solution)
                .SelectMany(ParseLaunchJsonFile)
                .Where(t => t.config.TryGetValue("type", out JToken type) && type.Value<string>() == "neo-contract")
                .ToList();
            if (launchConfigs.Count == 0)
            {
                _ = VsShellUtilities.ShowMessageBox(
                    package,
                    "No neo-contract Launch Configurations Found",
                    nameof(LaunchNeoDebugger),
                    OLEMSGICON.OLEMSGICON_INFO,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
                return;
            }
            JObject launchConfig = launchConfigs[0].config;
            if (launchConfig.Count > 1)
            {
                var viewModel = new LaunchConfigSelectionViewModel(launchConfigs);
                var dialog = new LaunchConfigSelectionDialog() { DataContext = viewModel };
                if (dialog.ShowModal() != true) return;
                launchConfig = viewModel.SelectedLaunchConfig.Config;
            }
            try
            {
                LaunchDebugger(launchConfig);
            }
            catch (Exception ex)
            {
                _ = VsShellUtilities.ShowMessageBox(
                    package,
                    string.Format(CultureInfo.CurrentCulture, "Debugger Launch failed.  Error: {0}", ex.Message),
                    nameof(LaunchNeoDebugger),
                    OLEMSGICON.OLEMSGICON_WARNING,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            }
        }
private void Execute ( object sender , EventArgs e ) { ThreadHelper . ThrowIfNotOnUIThread ( ) ; var dte = ServiceProvider . GetService < SDTE , DTE2 > ( ) ; var launchConfigs = GetLaunchJsonFiles ( dte . Solution ) . SelectMany ( ParseLaunchJsonFile ) . Where ( t => t . config . TryGetValue ( " " , out JToken type ) && type . Value < string > ( ) == " " ) . ToList ( ) ; if ( launchConfigs . Count == 0 ) { _ = VsShellUtilities . ShowMessageBox ( package , " " , nameof ( LaunchNeoDebugger ) , OLEMSGICON . OLEMSGICON_INFO , OLEMSGBUTTON . OLEMSGBUTTON_OK , OLEMSGDEFBUTTON . OLEMSGDEFBUTTON_FIRST ) ; return ; } JObject launchConfig = launchConfigs [ 0 ] . config ; if ( launchConfig . Count > 1 ) { var viewModel = new LaunchConfigSelectionViewModel ( launchConfigs ) ; var dialog = new LaunchConfigSelectionDialog ( ) { DataContext = viewModel } ; if ( dialog . ShowModal ( ) != true ) return ; launchConfig = viewModel . SelectedLaunchConfig . Config ; } try { LaunchDebugger ( launchConfig ) ; } catch ( Exception ex ) { _ = VsShellUtilities . ShowMessageBox ( package , string . Format ( CultureInfo . CurrentCulture , " " , ex . Message ) , nameof ( LaunchNeoDebugger ) , OLEMSGICON . OLEMSGICON_WARNING , OLEMSGBUTTON . OLEMSGBUTTON_OK , OLEMSGDEFBUTTON . OLEMSGDEFBUTTON_FIRST ) ; } }
This function is the callback used to execute the command when the menu item is clicked.
This function is the callback used to execute the command when the menu item is clicked .
sender
object
None
e
EventArgs
None