public void SetDataFromDto(PolygonDTO polygonDto) { _points = polygonDto.Points; _verticalHorizontals = polygonDto.VerticalHorizontals; _maxSizes = polygonDto.MaxSizes; _currentPointCount = polygonDto.CurrentPointCount; }
public PolygonDTO GetPolygonDTO() { var polygonDto = new PolygonDTO { Points = _points, VerticalHorizontals = _verticalHorizontals, MaxSizes = _maxSizes, CurrentPointCount = _currentPointCount }; return(polygonDto); }
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(); }