public ExprElement(string text) { PrevInput = text; TimeToExecute = DateTime.Now.ToString("tt hh:mm:ss"); BorderBrush = (Brush)App.Current.FindResource("ThemeColor"); bool successIn = false; Stopwatch stopwatch = Stopwatch.StartNew(); try { InputExpr = ExpressionParser.ParseExpression(text); InputType = GetPrettyType(InputExpr); successIn = true; } catch (ExprCoreException e) { InputExpr = new ErrorTextTokenType(e.Message); Result = new ErrorTextTokenType("입력값에 오류가 있습니다."); BorderBrush = (Brush)App.Current.FindResource("ErrorColor"); InputType = "Error"; OutputType = "Error"; } if (successIn) { UpdateResult(); } stopwatch.Stop(); long time = stopwatch.ElapsedMilliseconds; ExecutionTime = time == 0 ? "매우 짧음" : (time + "ms"); }
public void UpdateResult() { try { Result = VariableManager.EvaluateWithVariable(InputExpr); OutputType = GetPrettyType(Result); } catch (ExprCoreException e) { Result = new ErrorTextTokenType(e.Message); BorderBrush = (Brush)App.Current.FindResource("ErrorColor"); OutputType = "Error"; } }