Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AttachToILRuntime"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private AttachToILRuntime(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            this.package = package;

            ILRuntimeDebugEngine.AD7.AD7Engine.ShowErrorMessageBoxAction = (title, text) =>
                                                                           ShowShellMessageBox(title, text, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGICON.OLEMSGICON_CRITICAL);

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                //AddCommand(commandService, CommandId, this.MenuItemCallback);
                AddCommand(commandService, AttachToILRuntimeInLANId, this.MenuAttachToILRuntimeInLANCallback);
            }

            ThreadHelper.ThrowIfNotOnUIThread();

            var debugger = (IVsDebugger)this.ServiceProvider.GetService(typeof(IVsDebugger));

            if (debugger != null)
            {
                debugger.AdviseDebuggerEvents(this, out _);
            }

            LauncherForm.StartFetchRemoteDebugger(package);
        }
Ejemplo n.º 2
0
        ///// <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)
        //{
        //    FrmLauncher launcher = new FrmLauncher();
        //    if(launcher.ShowDialog() == DialogResult.OK)
        //    {
        //        LaunchDebugTarget(launcher.Host, launcher.Host);
        //    }
        //}

        private void MenuAttachToILRuntimeInLANCallback(object sender, EventArgs e)
        {
            LauncherForm launcher = new LauncherForm();

            if (launcher.ShowDialog() == DialogResult.OK)
            {
                if (launcher.ShowEnterIpAndPortForm)
                {
                    FrmLauncher enterIpAndPortForm = new FrmLauncher();
                    if (enterIpAndPortForm.ShowDialog() == DialogResult.OK)
                    {
                        LaunchDebugTarget(enterIpAndPortForm.Host, enterIpAndPortForm.Host);
                    }
                }
                else
                {
                    LaunchDebugTarget(launcher.Debugger.Host, $"{launcher.Debugger.ProjectName}({launcher.Debugger.Host})");
                }
            }
        }