Exemplo n.º 1
0
        private async Task DumpFormatAsync(ExpressionViewModel vm, string msg) =>
        //if ()
        //{
        //    return ;
        //}

        //var retVal = SerializingFormatter.Format(
        //    Interpreter,
        //    true,
        //    Interpreter.GetReturnValue(),
        //    ignoreNull: false,
        //    ignoreClrObj: false,
        //    scopes: AphidObject.GetScopeAncestors(Interpreter.CurrentScope));
        //return CodeViewer.Run(() => vm.Value = retVal);


        await CodeViewer.Run(
            x => vm.Value = x,
            await(msg != null ?
                  (Func <Task <string> >)(() => Task.FromResult(msg)) :
                  (() => Task.Run(
                       () => SerializingFormatter.Format(
                           Interpreter,
                           true,
                           Interpreter.GetReturnValue(),
                           ignoreNull: false,
                           ignoreClrObj: false,
                           scopes: AphidObject
                           .GetScopeAncestors(Interpreter.CurrentScope)))))());