示例#1
0
        private void ScriptingEngineOnEvaluateCompleted(object sender, EvaluateCompletedEventArgs evaluateCompletedEventArgs)
        {
            Execute.OnUIThread(() =>
            {
                var result = evaluateCompletedEventArgs.Resuslt;
                if (!result.InputComplete)
                {
                    partialCommand = result.Input;
                    prompt = promptIncomplete;
                }
                else
                {
                    partialCommand = "";
                    prompt = promptComplete;
                }

                if (result.HasErrors)
                    WriteLine(String.Join(Environment.NewLine, result.Errors), TextType.Error);
                if (result.HasWarnings)
                {
                    var warnings = FilterWarnings(result.Warnings).ToList();
                    if(warnings.Any())
                        WriteLine(String.Join(Environment.NewLine, warnings), TextType.Warning);
                }

                if (result.HasResult && result.Result != null)
                    WriteLine(ToPrettyString(result.Result));

                executingInternalCommand = false;
                evaluationsRunning--;
                if (!IsEvaluating)
                {
                    if (ScriptingInteractiveBase.ClearRequested)
                    {
                        Clear();
                        ScriptingInteractiveBase.ClearRequested = false;
                    }
                    else
                        WritePrompt();
                }
            });
        }
示例#2
0
 private void OnEvaluateCompleted(EvaluateCompletedEventArgs e)
 {
     EventHandler<EvaluateCompletedEventArgs> handler = EvaluateCompleted;
     if (handler != null) handler(this, e);
 }