allgemeine Kategorie MyShape: IXmlSerializable
{
allgemeines int _id;
allgemeines Schnur _name;
allgemeines Polygon_polygon = -null;
allgemeines MyShape ()
{
_polygon = neues Polygon ();
_polygon. Anschlag = System.Windows.Media.Brushes.Black;
_polygon. Fülle = System.Windows.Media.Brushes.LightSeaGreen;
_polygon.StrokeThickness = 2;
_polygon.HorizontalAlignment = HorizontalAlignment.Left;
}
allgemeines MyShape (int-Identifikation, Schnurname)
{
_id = Identifikation;
_name = Name;
_polygon = neues Polygon ();
_polygon. Anschlag = System.Windows.Media.Brushes.Black;
_polygon. Fülle = System.Windows.Media.Brushes.LightSeaGreen;
_polygon.StrokeThickness = 2;
_polygon.HorizontalAlignment = HorizontalAlignment.Left;
_polygon.VerticalAlignment = VerticalAlignment.Center;
System.Windows.Point Point1 = neues System.Windows.Point (1, 50);
System.Windows.Point Point2 = neues System.Windows.Point (10, 80);
System.Windows.Point Point3 = neues System.Windows.Point (50, 50);
PointCollection myPointCollection = neues PointCollection ();
myPointCollection.Add (Point1);
myPointCollection.Add (Point2);
myPointCollection.Add (Point3);
_polygon. Punkte = myPointCollection;
}
#region IXmlSerializable Mitglieder
allgemeines XmlSchema GetSchema ()
{
Rückkehr (Null);
}
Öffentlichkeit leeres ReadXml (XmlReader Leser)
{
Leser. Gelesen ();
XmlSerializer x = neues XmlSerializer (typeof (Schnur));
_id = int. Analysieren (x.Deserialize (Leser) .ToString ());
_name = x.Deserialize (Leser) .ToString ();
_polygon. Punkte = neues PointCollection (x.Deserialize (Leser) .ToString (). Spalte („; ").Select (n => Point.Parse (N)));
}
Öffentlichkeit leeres WriteXml (XmlWriter Verfasser)
{
XmlSerializer x = neues XmlSerializer (typeof (Schnur));
x.Serialize (Verfasser, _id.ToString ());
x.Serialize (Verfasser, _name);
x.Serialize (Verfasser, Schnur. Verbinden („; “, _polygon. Points.Cast (). Vorwählen (n => n.ToString ()).ToArray ()));
}
#endregion
}
|