예제 #1
0
        void OnViewConsoleInput(object sender, ConsoleInputEventArgs e)
        {
            if (!DebuggingService.IsDebugging)
            {
                view.WriteOutput(GettextCatalog.GetString("Debug session not started."));
                FinishPrinting();
            }
            else if (DebuggingService.IsRunning || DebuggingService.CurrentFrame == null)
            {
                view.WriteOutput(GettextCatalog.GetString("The expression can't be evaluated while the application is running."));
                FinishPrinting();
            }
            else
            {
                var frame      = DebuggingService.CurrentFrame;
                var ops        = GetEvaluationOptions(false);
                var expression = e.Text;

                var vres = frame.ValidateExpression(expression, ops);
                if (!vres)
                {
                    view.WriteOutput(vres.Message);
                    FinishPrinting();
                    return;
                }

                var val = frame.GetExpressionValue(expression, ops);
                if (val.IsEvaluating)
                {
                    WaitForCompleted(val, frame.DebuggerSession);
                    DebuggingService.NotifyVariableChanged();
                    return;
                }

                DebuggingService.NotifyVariableChanged();
                PrintValue(val);
            }
        }