Example #1
0
        public DebugManager()
        {
            BreakPointManager = new BreakPointManager();

            StartDebuggingCommand = ReactiveCommand.Create();
            StartDebuggingCommand.Subscribe(async o =>
            {
                switch (_shell.CurrentPerspective)
                {
                case Perspective.Editor:
                    if (o == null)
                    {
                        o = _shell.CurrentSolution.StartupProject;
                    }

                    if (o is IProject)
                    {
                        var masterProject = o as IProject;

                        //WorkspaceViewModel.Instance.SaveAllCommand.Execute(null);

                        Task.Factory.StartNew(async() =>
                        {
                            //WorkspaceViewModel.Instance.ExecutingCompileTask = true;

                            if (await masterProject.ToolChain.Build(_console, masterProject))
                            {
                                //Debugger = masterProject.SelectedDebugAdaptor;

                                if (CurrentDebugger != null)
                                {
                                    //await WorkspaceViewModel.Instance.DispatchDebug((Action)(() =>
                                    {
                                        StartDebug(masterProject);
                                    }                                             //));
                                }
                                else
                                {
                                    _console.WriteLine(
                                        "You have not selected a debug adaptor. Please goto Tools->Options to configure your debug adaptor.");
                                }
                            }

                            //WorkspaceViewModel.Instance.ExecutingCompileTask = false;
                        });
                    }
                    break;

                case Perspective.Debug:
                    // Begin dispatch otherwise UI is awaiting debugger. Inversion of control.
                    //WorkspaceViewModel.Instance.BeginDispatchDebug(() =>
                    {
                        PrepareToRun();
                        await CurrentDebugger.ContinueAsync();
                    }                     //);
                    break;
                }
            } /*, (o) =>
               * {
               * bool result = false;
               *
               * switch (WorkspaceViewModel.Instance.CurrentPerspective)
               * {
               * case Perspective.Editor:
               * if (WorkspaceViewModel.Instance.SolutionExplorer.SelectedProject != null && !WorkspaceViewModel.Instance.ExecutingCompileTask)
               * {
               * result = true;
               * }
               * break;
               *
               * case Perspective.Debug:
               * result = StepCommandsCanExecute(o);
               * break;
               * }
               *
               * return result;
               * }*/                        );

            RestartDebuggingCommand = ReactiveCommand.Create();
            //(o) => WorkspaceViewModel.Instance.CurrentPerspective == Perspective.Debug && Debugger != null && !IsUpdating);
            RestartDebuggingCommand.Subscribe(_ =>
            {
                SetDebuggers(currentDebugger);

                // Begin dispatch other wise ui thread is awaiting the debug thread. Inversion of control.
                //WorkspaceViewModel.Instance.BeginDispatchDebug(() =>
                {
                    PrepareToRun();
                    //Debugger.Reset(project.UserData.RunImmediately);
                }                 //);
            });

            StopDebuggingCommand = ReactiveCommand.Create();
            //(o) => WorkspaceViewModel.Instance.CurrentPerspective == Perspective.Debug && Debugger != null && !IsUpdating);
            StopDebuggingCommand.Subscribe(_ => { Stop(); });

            InterruptDebuggingCommand = ReactiveCommand.Create();
            //, (o) => WorkspaceViewModel.Instance.CurrentPerspective == Perspective.Debug && Debugger != null && Debugger.State == DebuggerState.Running && !IsUpdating);
            InterruptDebuggingCommand.Subscribe(async _ => { await CurrentDebugger.PauseAsync(); });

            StepIntoCommand = ReactiveCommand.Create();             //stepcommand can execute.
            StepIntoCommand.Subscribe(_ => { StepInto(); });

            StepInstructionCommand = ReactiveCommand.Create();             // }, StepCommandsCanExecute);
            StepInstructionCommand.Subscribe(_ => { StepInstruction(); });

            StepOverCommand = ReactiveCommand.Create();             // }, StepCommandsCanExecute);
            StepOverCommand.Subscribe(_ => { StepOver(); });

            StepOutCommand = ReactiveCommand.Create();             // , StepCommandsCanExecute);
            StepOutCommand.Subscribe(_ => { StepOut(); });
        }
Example #2
0
        void StopToolStripMenuItemClick(object sender, EventArgs e)
        {
            StopDebuggingCommand stopCommand = new StopDebuggingCommand();

            stopCommand.Run();
        }
Example #3
0
        void StopDebugging()
        {
            var stopCommand = new StopDebuggingCommand();

            stopCommand.Run();
        }