Beispiel #1
0
        private async void Initialize()
        {
            using AreaApi areaApi = new();

            IEnumerable <AreaDto> areas = await areaApi.ReadAsync();

            MyShapes.Clear();

            foreach (AreaDto area in areas)
            {
                MyShape myShape = new()
                {
                    Id       = area.Id,
                    Name     = area.Name,
                    IsClosed = area.IsClosed
                };

                using AreaPointApi areaPointApi = new();

                IEnumerable <AreaPointDto> areaPoints = await areaPointApi.ReadAsync(area.Id);

                if (areaPoints is null)
                {
                    continue;
                }

                foreach (AreaPointDto areaPoint in areaPoints)
                {
                    myShape.ShapePoints.Add(new ShapePoint()
                    {
                        Id       = areaPoint.Id,
                        AreaId   = areaPoint.AreaId,
                        Position = new Point(areaPoint.X, areaPoint.Y)
                    });
                }

                MyShapes.Add(myShape);
            }
        }
 public void clear()
 {
     MyShapes.Clear();
 }