private void ShowSlopedFacilityWS()
{
double storageDepth2 = Convert.ToDouble(txtStorageDepth2.Text);
double storageDepth3 = Convert.ToDouble(txtStorageDepth3.Text);
double growingMediumDepth = Convert.ToDouble(txtGrowingMediumDepth.Text);
double freeboardDepth = Convert.ToDouble(txtFreeboardDepth.Text);
double rockStorageDepth = Convert.ToDouble(txtRockStorageDepth.Text);
double rockStorageVoidRatio = Convert.ToDouble(txtRockVoidRatio.Text);
FacilityShape shape = GetFacilityShape(cmbFacilityShape.Text);
FacilityConfiguration config = (FacilityConfiguration)cmbFacilityConfiguration.Text[0];
FacilityType type = GetFacilityType(cmbFacilityType.Text);
List<SlopedFacilitySegment> segments = new List<SlopedFacilitySegment>();
SlopedFacility facility = new SlopedFacility(type, config, new Catchment("test catchment"), segments)
{
StorageDepth2In = storageDepth2,
StorageDepth3In = storageDepth3,
GrowingMediumDepthIn = growingMediumDepth,
FreeboardIn = freeboardDepth,
RockStorageDepthIn = rockStorageDepth,
RockVoidRatio = rockStorageVoidRatio,
Shape = shape
};
if (_sfws == null || _sfws.Disposing)
_sfws = new SlopedFacilityWorksheet(facility);
else
{
facility.Segments = _sfws.Segments; // connect new facility object to existing segments.
_sfws.Facility = facility; // change worksheet object to new facility object.
}
try
{
_sfws.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}