Пример #1
0
        internal override Element Parse(XElement element)
        {
            base.ParseXml(element);

            if (element.HasElements)
            {
                List <Element> nodes = new List <Element>();

                element.Elements().ToList().ForEach(entry =>
                {
                    string nodeName = entry.Name.LocalName;
                    if (ElementCollection.Contains(nodeName))
                    {
                        nodes.Add(ElementCollection
                                  .Resolve(nodeName)
                                  .Parse(entry));
                    }
                });

                Element cmd = nodes.Where(entry => (entry is Command)).FirstOrDefault();
                this.command = cmd == null ? null : (cmd as Command);

                nodes
                .Where(transition => (transition is Transition))
                .ToList()
                .ForEach(g =>
                {
                    this.Transitions.Add(g as Transition);
                });
            }
            return(this);
        }
Пример #2
0
        internal override Element Parse(XElement element)
        {
            base.ParseXml(element);

            if (element.HasElements)
            {
                List <Element> nodes = new List <Element>();
                element.Elements().ToList().ForEach(entry =>
                {
                    string nodeName = entry.Name.LocalName;
                    if (ElementCollection.Contains(nodeName))
                    {
                        nodes.Add(ElementCollection
                                  .Resolve(nodeName)
                                  .Parse(entry));
                    }
                });

                nodes
                .Where(group => (group is Group))
                .ToList()
                .ForEach(g =>
                {
                    this.Groups.Add(g as Group);
                });


                nodes
                .Where(transition => (transition is Transition))
                .ToList()
                .ForEach(g =>
                {
                    this.Transitions.Add(g as Transition);
                });

                nodes
                .Where(actor => (actor is Actor))
                .ToList()
                .ForEach(actor =>
                {
                    this.actors.Add(actor as Actor);
                });
            }
            return(this);
        }
Пример #3
0
        public void DeleteLink(BaseLinkElement linkElement)
        {
            if (linkElement != null)
            {
                linkElement.Connector1.RemoveLink(linkElement);
                linkElement.Connector2.RemoveLink(linkElement);

                if (_elements.Contains(linkElement))
                {
                    _elements.Remove(linkElement);
                }
                if (SelectedElements.Contains(linkElement))
                {
                    SelectedElements.Remove(linkElement);
                }
                OnAppearancePropertyChanged(new EventArgs());
            }
        }