public void addToList(int x, int y, Color c, SHAPE_TYPE type)
 {
     if (type == SHAPE_TYPE.Circle)
     {
         MyShapes.Add(new Circle(x, y, c));
     }
     if (type == SHAPE_TYPE.Square)
     {
         MyShapes.Add(new Square(x, y, c));
     }
     if (type == SHAPE_TYPE.Triangle)
     {
         MyShapes.Add(new Triangle(x - 10, y - 50, c, new Point(x + 50, y), new Point(x, y + 70)));
     }
 }
Esempio n. 2
0
        private void _mapEntitiesHub_OnAreaReceived(AreaDto areaDto)
        {
            MyShape myShape = new()
            {
                Id       = areaDto.Id,
                Name     = areaDto.Name,
                IsClosed = areaDto.IsClosed
            };

            MyShape firstShape = MyShapes.FirstOrDefault(s => s.Id == myShape.Id);

            if (firstShape is null)
            {
                MyShapes.Add(myShape);
            }
            else
            {
                firstShape.IsClosed = myShape.IsClosed;
            }
        }
Esempio n. 3
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);
            }
        }
Esempio n. 4
0
 private void AddShape(object obj)
 {
     shape = new MyShapeModel();
     MyShapes.Add(shape);
 }