public override void SaveInFile(XmlWriter file, int elementId, Hashtable elementsId)
        {
            file.WriteElementString("id", elementId.ToString());
            file.WriteElementString("key", this.key);

            file.WriteStartElement("finish");
            file.WriteStartElement("position");
            file.WriteElementString("x", this.Center.X.ToString());
            file.WriteElementString("y", this.Center.Y.ToString());
            file.WriteEndElement();
            file.WriteStartElement("previous");
            foreach (Connector connector in this.previous)
            {
                foreach (GraphElement prevElement in connector.Connections)
                {
                    int id;
                    if (elementsId.ContainsKey(prevElement))
                    {
                        id = (int)elementsId[prevElement];
                    }
                    else
                    {
                        id = GraphDiagram.GetElementId();
                        elementsId.Add(prevElement, id);
                    }
                    file.WriteElementString("elementId", id.ToString());
                    file.WriteElementString("connectorId", connector.IdConnector.ToString());
                }
            }
            file.WriteEndElement();

            file.WriteEndElement();
        }
        public override void SaveInFile(XmlWriter file, int elementId, Hashtable elementsId)
        {
            file.WriteElementString("id", elementId.ToString());
            file.WriteElementString("key", this.key);

            file.WriteStartElement("start");
            file.WriteStartElement("position");
            file.WriteElementString("x", this.Center.X.ToString());
            file.WriteElementString("y", this.Center.Y.ToString());
            file.WriteEndElement();
            file.WriteStartElement("next");
            if (this.Next != null)
            {
                int id;
                if (elementsId.ContainsKey(this.Next))
                {
                    id = (int)elementsId[this.Next];
                }
                else
                {
                    id = GraphDiagram.GetElementId();
                    elementsId.Add(this.Next, id);
                }
                file.WriteElementString("elementId", id.ToString());
                file.WriteElementString("connectorId", this.next.IdConnector.ToString());
            }
            file.WriteEndElement();

            file.WriteEndElement();
        }
        public override void SaveInFile(XmlWriter file, int elementId, Hashtable elementsId)
        {
            file.WriteElementString("id", elementId.ToString());
            file.WriteElementString("key", this.key);

            file.WriteStartElement("arrow");
            file.WriteStartElement("position");
            file.WriteElementString("x", this.Center.X.ToString());
            file.WriteElementString("y", this.Center.Y.ToString());
            file.WriteEndElement();
            file.WriteStartElement("previous");
            foreach (Connector connector in this.previous)
            {
                int id;
                if (elementsId.ContainsKey(connector.Parent))
                {
                    id = (int)elementsId[connector.Parent];
                }
                else
                {
                    id = GraphDiagram.GetElementId();
                    elementsId.Add(connector.Parent, id);
                }
                file.WriteElementString("elementId", id.ToString());
                file.WriteElementString("connectorId", connector.IdConnector.ToString());
            }
            file.WriteEndElement();

            file.WriteStartElement("next");
            if (this.Next != null)
            {
                int id;
                if (elementsId.ContainsKey(this.Next))
                {
                    id = (int)elementsId[this.Next];
                }
                else
                {
                    id = GraphDiagram.GetElementId();
                    elementsId.Add(this.Next, id);
                }
                file.WriteElementString("elementId", id.ToString());
                file.WriteElementString("connectorId", this.next.IdConnector.ToString());
            }
            file.WriteEndElement();

            file.WriteStartElement("points");
            foreach (ArrowSegment segment in this.segments)
            {
                file.WriteStartElement("position");
                file.WriteElementString("x", segment.StartPoint.X.ToString());
                file.WriteElementString("y", segment.StartPoint.Y.ToString());
                file.WriteEndElement();
            }
            //the last position is saved
            file.WriteStartElement("position");
            file.WriteElementString("x", ((ArrowSegment)this.segments[this.segments.Count - 1]).EndPoint.X.ToString());
            file.WriteElementString("y", ((ArrowSegment)this.segments[this.segments.Count - 1]).EndPoint.Y.ToString());
            file.WriteEndElement();
            file.WriteEndElement();

            file.WriteEndElement();
        }