public DisplayValue(DialogVariableCondition condition, List <DialogVariableAssignment> assignList)
        {
            switch (condition.Comparison)
            {
            case ConditionComparison.HasValue:
                Value = "HasValue";
                break;

            case ConditionComparison.Equals:
                if (condition.Value == "")
                {
                    Value = condition.VariableName + " absent";
                }
                else
                {
                    Value = condition.Value;
                }
                break;

            default:
                break;
            }

            Variable   = condition.VariableName;
            Type       = DisplayValueType.Assign;
            Attributes = new List <Attribute>();
            string synonyms = "";

            if (condition.EntityValue != null && condition.EntityValue.Concepts != null)
            {
                foreach (var concept in condition.EntityValue.Concepts)
                {
                    if (concept.Synonyms != null && concept.Synonyms.Count > 0)
                    {
                        foreach (var syn in concept.Synonyms)
                        {
                            synonyms = synonyms + syn + "\r\n";
                        }
                    }
                }
            }

            Attributes.Add(new Attribute("title", synonyms));
            SecondaryInfo = "";

            foreach (var assign in assignList)
            {
                switch (assign.Operator)
                {
                case DialogVariableOperator.SetTo:
                    SecondaryInfo += assign.VariableName + " positionné à " + assign.Value + "<br>";
                    break;

                default:
                    break;
                }
            }
        }
        public DisplayValue(DialogVariableCondition condition)
        {
            switch (condition.Comparison)
            {
            case ConditionComparison.HasValue:
                Value = "HasValue";
                break;

            case ConditionComparison.Equals:
                if (condition.Value == "")
                {
                    Value = condition.VariableName + " absent";
                }
                else
                {
                    Value = condition.Value;
                }
                break;

            default:
                break;
            }

            Variable   = condition.VariableName;
            Type       = DisplayValueType.Variable;
            Attributes = new List <Attribute>();
            string synonyms = "";

            if (condition.EntityValue != null && condition.EntityValue.Concepts != null)
            {
                foreach (var concept in condition.EntityValue.Concepts)
                {
                    if (concept.Synonyms != null && concept.Synonyms.Count > 0)
                    {
                        foreach (var syn in concept.Synonyms)
                        {
                            synonyms = synonyms + syn + "\r\n";
                        }
                    }
                }
            }

            Attributes.Add(new Attribute("title", synonyms));
        }
        internal void LinkDialogVariableConditionToDialogVariableAndEntityValue(DialogNode dialogNode, DialogVariableCondition variableCondition, DialogVariablesSimulator dialogVariables)
        {
            if (String.IsNullOrEmpty(variableCondition.VariableName))
            {
                return;
            }

            DialogVariable variable    = null;
            EntityValue    entityValue = null;

            if (!Variables.ContainsKey(variableCondition.VariableName))
            {
                LogMessage(dialogNode.LineNumber, MessageType.InvalidReference, "Variable condition references undefined variable name : \"" + variableCondition.VariableName + "\"");
            }
            else
            {
                variable = Variables[variableCondition.VariableName];
                variable.AddDialogNodeReference(dialogNode, VariableReferenceType.Read);

                if (variableCondition.Comparison != ConditionComparison.HasValue && !String.IsNullOrEmpty(variableCondition.Value))
                {
                    var entity = dialogVariables.TryGetEntityFromVariable(variable);
                    if (entity != null)
                    {
                        entityValue = entity.TryGetEntityValueFromName(variableCondition.Value);
                        if (entityValue == null)
                        {
                            var message = "Variable condition references undefined entity value name \"" + variableCondition.Value + "\" for entity " + entity.Name;
                            var suggestedEntityValue = entity.SuggestEntityValueFromName(variableCondition.Value, Entities.Values);
                            if (suggestedEntityValue != null)
                            {
                                if (suggestedEntityValue.Entity == entity)
                                {
                                    message += ", you may want to replace this name with \"" + suggestedEntityValue.Name + "\" (defined line " + suggestedEntityValue.LineNumber + ")";
                                }
                                else
                                {
                                    message += ", you may want to move this condition under another entity \"" + suggestedEntityValue.Entity.Name + "\" with value \"" + suggestedEntityValue.Name + "\" (defined line " + suggestedEntityValue.LineNumber + ")";
                                }
                            }
                            LogMessage(dialogNode.LineNumber, MessageType.InvalidReference, message);
                        }
                        else
                        {
                            entityValue.AddDialogNodeReference(dialogNode);
                        }
                    }
                }
            }
            variableCondition.SetVariableAndEntityValue(variable, entityValue);
        }