示例#1
0
文件: PolygonData.cs 项目: Arnyev/GK
 public void SetDataFromDto(PolygonDTO polygonDto)
 {
     _points = polygonDto.Points;
     _verticalHorizontals = polygonDto.VerticalHorizontals;
     _maxSizes            = polygonDto.MaxSizes;
     _currentPointCount   = polygonDto.CurrentPointCount;
 }
示例#2
0
文件: PolygonData.cs 项目: Arnyev/GK
        public PolygonDTO GetPolygonDTO()
        {
            var polygonDto = new PolygonDTO
            {
                Points = _points,
                VerticalHorizontals = _verticalHorizontals,
                MaxSizes            = _maxSizes,
                CurrentPointCount   = _currentPointCount
            };

            return(polygonDto);
        }
示例#3
0
文件: MainForm.cs 项目: Arnyev/GK
        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();
        }