예제 #1
0
        private void DisplayValue(NuGenBaseValueRefresher valueRefresher, TreeNode parentNode)
        {
            fieldList.Items.Clear();
            evaluationLogListBox.Items.Clear();

            try
            {
                NuGenDebugExpressionResult debugValue = new NuGenDebugExpressionResult(EvaluationContext, valueRefresher.GetRefreshedValue());

                if (NuGenHelperFunctions.HasValueClass(debugValue.ResultValue))
                {
                    EnableControlsForEvaluation(false);
                    CancelValueFormattersDisplaying = false;
                    MissingModules     = new List <NuGenIValueFormatter>();
                    IsTypeOfValueFound = false;
                    ValueDisplayer.CreateComplexFormatter(debugValue, valueRefresher, FrameRefresher, parentNode);
                }
                else
                {
                    NuGenIValueFormatter valueFormatter = ValueDisplayer.CreateSimpleFormatter(debugValue);
                    valueFormatter.Name           = valueRefresher.Name;
                    valueFormatter.ValueRefresher = valueRefresher;
                    DisplayValueFormatter(valueFormatter);

                    if (valueFormatter is NuGenISimpleTypeValueFormatter)
                    {
                        NuGenStringValueFormatter valueTypeFormatter = new NuGenStringValueFormatter(((NuGenISimpleTypeValueFormatter)valueFormatter).GetNumberTypeName());
                        valueTypeFormatter.FieldGroup = ValueFieldGroup.ObjectInformation;
                        valueTypeFormatter.Name       = "Type of value";
                        DisplayValueFormatter(valueTypeFormatter);
                    }
                }
            }
            catch (NuGenEvaluationException evaluationException)
            {
                DisplayValueFormatter(new NuGenErrorValueFormatter("Evaluation exception", evaluationException.Message));
            }
            catch (NuGenEvaluationHandlerException evaluationHandlerException)
            {
                DisplayValueFormatter(new NuGenErrorValueFormatter("Evaluation running exception", evaluationHandlerException.Message));
            }
            catch (NugenMissingModuleException missingModuleException)
            {
                DisplayValueFormatter(new NuGenMissingModuleFormatter(missingModuleException.MissingModule));
            }
            catch (InvalidOperationException invalidOperationException)
            {
                DisplayValueFormatter(new NuGenErrorValueFormatter("Evaluation exception", invalidOperationException.Message));
            }
            catch (Exception exception)
            {
                DisplayValueFormatter(new NuGenErrorValueFormatter("Unexpected exception", exception.Message));
            }
        }