Inheritance: System.EventArgs
Example #1
0
 private void OnDeserializing(SerializeEventArgs e)
 {
     if (Deserializing != null)
     {
         Deserializing(this, e);
     }
 }
Example #2
0
 protected virtual void OnSerializing(SerializeEventArgs e)
 {
     if (Serializing != null)
     {
         Serializing(this, e);
     }
 }
Example #3
0
 protected virtual void OnDeserializing(SerializeEventArgs e)
 {
     if (Deserializing != null)
     {
         Deserializing(this, e);
     }
     OnModified(EventArgs.Empty);
 }
Example #4
0
 protected virtual void OnDeserializing(SerializeEventArgs e)
 {
     Deserializing?.Invoke(this, e);
     OnModified(EventArgs.Empty);
 }
Example #5
0
 private void OnDeserializing(SerializeEventArgs e)
 {
     Deserializing?.Invoke(this, e);
 }
Example #6
0
		protected virtual void OnDeserializing(SerializeEventArgs e)
		{
			XmlElement locationNode = e.Node["Location"];
			if (locationNode != null)
			{
				int left, top;

				int.TryParse(locationNode.GetAttribute("left"), out left);
				int.TryParse(locationNode.GetAttribute("top"), out top);
				this.Location = new Point(left, top);
			}

			XmlElement sizeNode = e.Node["Size"];
			if (sizeNode != null)
			{
				int width, height;

				int.TryParse(sizeNode.GetAttribute("width"), out width);
				int.TryParse(sizeNode.GetAttribute("height"), out height);
				this.Size = new Size(width, height);
			}
		}
Example #7
0
 protected virtual void OnSerializing(SerializeEventArgs e)
 {
     Serializing?.Invoke(this, e);
 }
Example #8
0
		private void OnDeserializing(SerializeEventArgs e)
		{
			if (Deserializing != null)
				Deserializing(this, e);
		}
Example #9
0
		protected virtual void OnSerializing(SerializeEventArgs e)
		{
			XmlElement locationNode = e.Node.OwnerDocument.CreateElement("Location");
			locationNode.SetAttribute("left", Left.ToString());
			locationNode.SetAttribute("top", Top.ToString());
			e.Node.AppendChild(locationNode);

			XmlElement sizeNode = e.Node.OwnerDocument.CreateElement("Size");
			sizeNode.SetAttribute("width", Width.ToString());
			sizeNode.SetAttribute("height", Height.ToString());
			e.Node.AppendChild(sizeNode);
		}
Example #10
0
		private void OnSerializing(SerializeEventArgs e)
		{
			if (Serializing != null)
				Serializing(this, e);
		}
Example #11
0
		protected virtual void OnDeserializing(SerializeEventArgs e)
		{
			if (Deserializing != null)
				Deserializing(this, e);
			OnModified(EventArgs.Empty);
		}
Example #12
0
		protected virtual void OnSerializing(SerializeEventArgs e)
		{
			if (Serializing != null)
				Serializing(this, e);
		}
Example #13
0
		protected virtual void OnDeserializing(SerializeEventArgs e)
		{
			// Old file format
			XmlElement oldStartNode = e.Node["StartNode"];
			XmlElement oldEndNode = e.Node["EndNode"];
			if (oldStartNode != null && oldEndNode != null)
			{
				bool isHorizontal;
				bool.TryParse(oldStartNode.GetAttribute("isHorizontal"), out isHorizontal);
				startOrientation = (isHorizontal) ? LineOrientation.Horizontal : LineOrientation.Vertical;
				bool.TryParse(oldEndNode.GetAttribute("isHorizontal"), out isHorizontal);
				endOrientation = (isHorizontal) ? LineOrientation.Horizontal : LineOrientation.Vertical;

				int startLocation, endLocation;
				int.TryParse(oldStartNode.GetAttribute("location"), out startLocation);
				int.TryParse(oldEndNode.GetAttribute("location"), out endLocation);

				Reroute();
				if (startOrientation == LineOrientation.Vertical)
					FirstBendPoint.X = startShape.Left + startLocation;
				else
					FirstBendPoint.Y = startShape.Top + startLocation;

				if (endOrientation == LineOrientation.Vertical)
					LastBendPoint.X = endShape.Left + endLocation;
				else
					LastBendPoint.Y = endShape.Top + endLocation;

				FirstBendPoint.AutoPosition = false;
				LastBendPoint.AutoPosition = false;
				Reroute();
			}
			else
			{
				// New file format
				XmlElement startNode = e.Node["StartOrientation"];
				if (startNode != null)
				{
					if (startNode.InnerText == "Horizontal")
						startOrientation = LineOrientation.Horizontal;
					else
						startOrientation = LineOrientation.Vertical;
				}
				XmlElement endNode = e.Node["EndOrientation"];
				if (endNode != null)
				{
					if (endNode.InnerText == "Horizontal")
						endOrientation = LineOrientation.Horizontal;
					else
						endOrientation = LineOrientation.Vertical;
				}

				if (startNode != null && endNode != null) // To be sure it's the new file format
				{
					bendPoints.Clear();

					XmlNodeList nodes = e.Node.SelectNodes("child::BendPoint");
					foreach (XmlElement node in nodes)
					{
						bool relativeToStartShape;
						bool.TryParse(node.GetAttribute("relativeToStartShape"), out relativeToStartShape);
						Shape relativeShape = relativeToStartShape ? startShape : endShape;

						BendPoint point = new BendPoint(relativeShape, relativeToStartShape, false);
						point.Deserialize(node);
						bendPoints.Add(point);
					}
					if (bendPoints.Count == 0 || !FirstBendPoint.RelativeToStartShape)
						bendPoints.AddFirst(new BendPoint(startShape, true));
					if (LastBendPoint.RelativeToStartShape)
						bendPoints.Add(new BendPoint(endShape, false));
				}
				Reroute();
			}
		}
Example #14
0
		protected virtual void OnSerializing(SerializeEventArgs e)
		{
			XmlDocument document = e.Node.OwnerDocument;

			XmlElement startNode = document.CreateElement("StartOrientation");
			startNode.InnerText = startOrientation.ToString();
			e.Node.AppendChild(startNode);

			XmlElement endNode = document.CreateElement("EndOrientation");
			endNode.InnerText = endOrientation.ToString();
			e.Node.AppendChild(endNode);

			foreach (BendPoint point in bendPoints)
			{
				if (!point.AutoPosition)
				{
					XmlElement node = document.CreateElement("BendPoint");
					node.SetAttribute("relativeToStartShape", point.RelativeToStartShape.ToString());
					point.Serialize(node);
					e.Node.AppendChild(node);
				}
			}
		}