Ejemplo n.º 1
0
 public void SetDataFromDto(PolygonDTO polygonDto)
 {
     _points = polygonDto.Points;
     _verticalHorizontals = polygonDto.VerticalHorizontals;
     _maxSizes            = polygonDto.MaxSizes;
     _currentPointCount   = polygonDto.CurrentPointCount;
 }
Ejemplo n.º 2
0
        public PolygonDTO GetPolygonDTO()
        {
            var polygonDto = new PolygonDTO
            {
                Points = _points,
                VerticalHorizontals = _verticalHorizontals,
                MaxSizes            = _maxSizes,
                CurrentPointCount   = _currentPointCount
            };

            return(polygonDto);
        }
Ejemplo n.º 3
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            var fileDialog = new SaveFileDialog();

            if (fileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var serializer = new BinaryFormatter();

            var path = fileDialog.FileName;
            var file = File.Create(path);

            var polygonsDto = new PolygonDTO[PolygonCount];

            for (int i = 0; i < PolygonCount; i++)
            {
                polygonsDto[i] = _polygons[i].GetPolygonDTO();
            }

            serializer.Serialize(file, polygonsDto);
            file.Close();
        }