예제 #1
0
        private void SendEvaluation(LocalVariable localVariable = null, GlobalVariable globalVariable = null)
        {
            FormulaEvaluationResult result;

            if (ParsingError != null)
            {
                // FormulaEditorKey key as parameter for this function
                //if (key != FormulaEditorKey.Delete)
                //{
                //    SelectionStart = ParsingError.Index;
                //    SelectionLength = ParsingError.Length;
                //}
                result = new FormulaEvaluationResult
                {
                    Error = AppResourcesHelper.Get("FormulaInterpreter_Error")
                };
            }
            else
            {
                var value       = FormulaEvaluator.Evaluate(Formula);
                var stringValue = value == null ? string.Empty : value.ToString();

                result = new FormulaEvaluationResult
                {
                    Value = stringValue,
                };
            }
            Messenger.Default.Send(result, ViewModelMessagingToken.FormulaEvaluated);
        }
예제 #2
0
        private void ShowErrorPressedAction()
        {
            if (SelectionStart == ParsingError.Index && CaretIndex != ParsingError.Index)
            {
                // to move caret to ParsingError.Index after showError --> user moved caret --> showError
                CaretIndex = ParsingError.Index;
            }
            else
            {
                SelectionStart = ParsingError.Index;
            }
            SelectionLength = ParsingError.Length;
            var errorMessage = ParsingError.Message;
            FormulaEvaluationResult result = new FormulaEvaluationResult
            {
                Error = errorMessage
            };

            Messenger.Default.Send(result, ViewModelMessagingToken.FormulaEvaluated);
        }
 private void FormulaChangedMessageAction(FormulaEvaluationResult result)
 {
     ServiceLocator.DispatcherService.RunOnMainThread(() =>
         {
             TextBlockEvaluationValue.Text = result.Value ?? "";
             TextBlockEvaluationError.Text = result.Error ?? "";
         });
 }
 private void ShowErrorPressedAction()
 {
     if (SelectionStart == ParsingError.Index && CaretIndex != ParsingError.Index)
     {
         // to move caret to ParsingError.Index after showError --> user moved caret --> showError
         CaretIndex = ParsingError.Index;
     }
     else
     {
         SelectionStart = ParsingError.Index;
     }
     SelectionLength = ParsingError.Length;
     var errorMessage = ParsingError.Message;
     FormulaEvaluationResult result = new FormulaEvaluationResult
     {
         Error = errorMessage
     };
     Messenger.Default.Send(result, ViewModelMessagingToken.FormulaEvaluated);
 }
        private void SendEvaluation(LocalVariable localVariable = null, GlobalVariable globalVariable = null)
        {
            FormulaEvaluationResult result;

            if (ParsingError != null)
            {
                // FormulaEditorKey key as parameter for this function
                //if (key != FormulaEditorKey.Delete)
                //{
                //    SelectionStart = ParsingError.Index;
                //    SelectionLength = ParsingError.Length;
                //}      
                result = new FormulaEvaluationResult
                {
                    Error = AppResourcesHelper.Get("FormulaInterpreter_Error")
                };
            }
            else
            {
                var value = FormulaEvaluator.Evaluate(Formula);
                var stringValue = value == null ? string.Empty : value.ToString();

                result = new FormulaEvaluationResult
                {
                    Value = stringValue,
                };
            }
            Messenger.Default.Send(result, ViewModelMessagingToken.FormulaEvaluated);
        }