예제 #1
0
        public void Run(string sCode, Action<object, Exception> executionEnd)
        {
            _consoleRedirect = new ConsoleRedirect();
            VSTools.LogStartRunning();
            try
            {
                var result = CSharpScript.RunAsync(sCode, defaultOptions, globals: new Globals());

                result.ContinueWith(OnException, executionEnd, TaskContinuationOptions.OnlyOnFaulted);
                result.ContinueWith(OnSuccess, executionEnd, TaskContinuationOptions.OnlyOnRanToCompletion);
            }
            catch(Exception ex)
            {
                _consoleRedirect.Dispose();
                VSTools.LogError(ex);
                VSTools.LogEndRunning(true);
                executionEnd(null, ex);
            }
        }
예제 #2
0
        public void Run(string sCode, Action <object, Exception> executionEnd)
        {
            _consoleRedirect = new ConsoleRedirect();
            VSTools.LogStartRunning();
            try
            {
                var result = CSharpScript.RunAsync(sCode, defaultOptions, globals: new Globals());

                result.ContinueWith(OnException, executionEnd, TaskContinuationOptions.OnlyOnFaulted);
                result.ContinueWith(OnSuccess, executionEnd, TaskContinuationOptions.OnlyOnRanToCompletion);
            }
            catch (Exception ex)
            {
                _consoleRedirect.Dispose();
                VSTools.LogError(ex);
                VSTools.LogEndRunning(true);
                executionEnd(null, ex);
            }
        }