コード例 #1
0
		void OnViewConsoleInput (object sender, ConsoleInputEventArgs e)
		{
			if (!DebuggingService.IsDebugging) {
				view.WriteOutput ("Debug session not started.");
			} else if (DebuggingService.IsRunning) {
				view.WriteOutput ("The expression can't be evaluated while the application is running.");
			} else {
				EvaluationOptions ops = EvaluationOptions.DefaultOptions;
				ops.AllowMethodEvaluation = true;
				ops.AllowToStringCalls = true;
				ops.AllowTargetInvoke = true;
				ops.EvaluationTimeout = 20000;
				ops.EllipsizeStrings = false;
				var ff = DebuggingService.CurrentFrame;
				string tt = e.Text;
				ValidationResult vres = ff.ValidateExpression (tt, ops);
				if (!vres) {
					view.WriteOutput (vres.Message);
					view.Prompt (true);
					return;
				}
				ObjectValue val = DebuggingService.CurrentFrame.GetExpressionValue (e.Text, ops);
				if (val.IsEvaluating) {
					WaitForCompleted (val);
					return;
				}
				PrintValue (val);
			}
			view.Prompt (true);
		}
コード例 #2
0
ファイル: ImmediatePad.cs プロジェクト: rae1/monodevelop
		void OnViewConsoleInput (object sender, ConsoleInputEventArgs e)
		{
			if (!DebuggingService.IsDebugging) {
				view.WriteOutput (GettextCatalog.GetString ("Debug session not started."));
				FinishPrinting ();
			} else if (DebuggingService.IsRunning) {
				view.WriteOutput (GettextCatalog.GetString ("The expression can't be evaluated while the application is running."));
				FinishPrinting ();
			} else {
				var frame = DebuggingService.CurrentFrame;
				var ops = GetEvaluationOptions ();
				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);
					return;
				}

				PrintValue (val);
			}
		}	
コード例 #3
0
    protected void OnConsoleview1ConsoleInput(object sender, MonoDevelop.Components.ConsoleInputEventArgs e)
    {
        string command = e.Text;

        ExecuteCommand(command);
        ExecutePrompt();
    }
コード例 #4
0
        void HandleConsoleInput(object sender, MonoDevelop.Components.ConsoleInputEventArgs e)
        {
            string input = e.Text;

            if (input == null)
            {
                consoleview.Prompt(true);
                return;
            }

            string inputL = input.Trim().ToLowerInvariant();

            if (inputL == "help" ||
                inputL == "help()" ||
                inputL.StartsWith("?"))
            {
                // treat this input specially to help the user. we do not pass this line to the python interpreter.

                consoleview.WriteOutput("Congratulations, you have found the help function :)" + "\n" +
                                        "This window is an interactive Python command line. You can input Python commands" + "\n" +
                                        "and will see their outputs directly." + "\n" +
                                        "To get more help, use the help() function, taking 1 parameter." + "\n" +
                                        "It will show help for that parameter, including for example all its methods etc." + "\n" +
                                        "To get a list of all available such parameters, you can use" + "\n" +
                                        "   print dir()" + "\n" +
                                        "That command returns a list of all available global objects. The most interesting one in there is" + "\n" +
                                        "app(), which is the invocation of a getter for the main application object." + "\n" +
                                        "To see which methods that object offers, run" + "\n" +
                                        "   help(app())" + "\n" +
                                        "Especially, this object has 4 interesting methods:" + "\n" +
                                        "   print app().ListInstances()" + "\n" +
                                        "prints a list of all currently instantiated components." + "\n" +
                                        "Each of them can be accessed by" + "\n" +
                                        "   app().GetInstance(\"xyz\")" + "\n" +
                                        ", for example" + "\n" +
                                        "   app().GetInstance(\"Map Explorer 2\")" + "\n" +
                                        "You can also instantiate new components: To get a list of the available ones, run" + "\n" +
                                        "   print app().ListComponentTypes()" + "\n" +
                                        "Creation then works like this:" + "\n" +
                                        "   print app().CreateComponent(\"xyz\")"
                                        );
                consoleview.Prompt(true);
                return;
            }

            bool ok = true;

            DisableInvokeOnAccessingConsoleView = true;
            try { ComponentManager.Execute(input); }
            catch (Exception ex)
            {
                consoleview.WriteOutput("Error: " + ex.Message);
                ok = false;
            }
            DisableInvokeOnAccessingConsoleView = false;

            if (ok)
            {
                consoleview.Prompt(false);
            }
            else
            {
                consoleview.Prompt(true);
            }
        }
コード例 #5
0
		void OnConsoleInput (object sender, ConsoleInputEventArgs e)
		{
			viewModel.ProcessUserInput (e.Text);
		}
コード例 #6
0
 void HandleConsoleInput(object sender, ConsoleInputEventArgs e)
 {
     if (isPrompting) {
         isPrompting = false;
         session = null;
         SendCommand ("", "");
     } else {
         SendCommand ("", e.Text);
     }
 }