Example #1
0
        public static Task <string> ReadLineAsync()
        {
            EventCommandEntered handler = null;
            string value = null;
            var    tcs   = new TaskCompletionSource <string>();

            handler = new EventCommandEntered((s, e) =>
            {
                value = e.Command;
                tcs.SetResult(value);

                _shell.CommandEntered -= handler;
            });

            _shell.CommandEntered += handler;

            return(tcs.Task);
        }
        /// <summary>
        /// IronTextBoxControl
        /// </summary>
        public IronTextBoxControl(MushDLR223.ScriptEngines.ScriptInterpreter si)
        {
            //Create the ScriptRuntime
            engine = si;// Python.CreateEngine(); //ScriptRuntime.Create().GetEngine("py");
            InitializeComponent();

            //Create the scope for the ScriptEngine
            scope = engine;//.CreateScope();
            //Expose our host application
            if (scope != null) scope.Intern("app", this);
            //IronTextBox's CommandEntered event
            CommandEntered += new EventCommandEntered(irontextboxControl_CommandEntered);
        }