Beispiel #1
0
        public void Serialize(string _path)
        {
            var s = new HexagonesModel();
            int j = 0;

            foreach (var i in Polygones)
            {
                s.Shapes.Add(new HexagonModel()
                {
                    Points = i.Points, Fill = i.Fill, Stroke = i.Stroke, Number = j, Left = Canvas.GetLeft(i), Top = Canvas.GetTop(i)
                });
                ++j;
            }
            s.Serialize(_path);
        }
Beispiel #2
0
        public void Deserialize(string _path)
        {
            var s = new HexagonesModel();

            Polygones = new ObservableCollection <Polygon>();
            s.Deserialize(_path);
            foreach (var i in s.Shapes)
            {
                Add(new Polygon()
                {
                    Points = i.Points, Fill = i.Fill, Stroke = i.Stroke
                });
                Canvas.SetLeft(Polygones.Last(), i.Left);
                Canvas.SetTop(Polygones.Last(), i.Top);
            }
        }