示例#1
0
        public override void Load(XElement element, KeyMapping keyMapping)
        {
            base.Load(element, keyMapping);

            var dataElements = element
                               .Elements(XName.Get("data", element.GetDefaultNamespace().NamespaceName))
                               .ToArray();

            var initialElem = dataElements
                              .Where(x => (string)x.Attribute("key") == keyMapping.InitialStateId)
                              .FirstOrDefault();

            var finalElem = dataElements
                            .Where(x => (string)x.Attribute("key") == keyMapping.FinalStateId)
                            .FirstOrDefault();

            IsInitial = ParsingUtility.ElementContentToBoolean(initialElem, keyMapping.InitialStateDefaultValue);
            IsFinal   = ParsingUtility.ElementContentToBoolean(finalElem, keyMapping.FinalStateDefaultValue);

            if (IsFinal)
            {
                if (Description == null)
                {
                    Description = "[FINAL]";
                }
            }

            CheckIdProperty(element);
            CheckDescriptionProperty(element);
        }