private void AddNewNozzle() { NozzleControl n = new NozzleControl { NozzleID = _nozzles.Count + 1 }; if (n.NozzleID == 1) { n.NozzleOrificeID = Constants._defaultOrificeID; n.NozzleSpacing = 0; n.NozzleToYankee = Constants._defaultNozzletoYankee; n.SprayRotation = Constants._defaultNozzlerotation; n.SprayAngle = Constants._defaultNozzleAngle; n.NozzlePressure = Constants._operatingpressure; n.NozzleTypeName = Constants.StandardNozzle; n.NozzleTypes = NozzleTypes; } else { n.NozzleOrificeID = Nozzles[n.NozzleID - 2].NozzleOrificeID; if (n.NozzleID > 2) { n.NozzleSpacing = Nozzles[n.NozzleID - 2].NozzleSpacing; } else { n.NozzleSpacing = Constants._defaultNozzleSpacing; } n.NozzleToYankee = Nozzles[n.NozzleID - 2].NozzleToYankee; n.SprayRotation = Nozzles[n.NozzleID - 2].SprayRotation; n.SprayAngle = Nozzles[n.NozzleID - 2].SprayAngle; n.NozzlePressure = Nozzles[0].NozzlePressure; n.NozzleTypeName = Nozzles[n.NozzleID - 2].NozzleTypeName; n.NozzleTypes = NozzleTypes; n.BoomTop = MaximumNozzleToYankee + Constants._nozzleheight + 20; } Nozzles.Add(n); if (Nozzles.Count > 1) { Nozzles[Nozzles.Count - 1].NozzleToYankee = MaximumNozzleToYankee; } }
private void OpenSelectedShowerFile(string _filename) { if (!string.IsNullOrEmpty(_filename) && File.Exists(_filename)) { try { Shower _shower = DeSerializeShower(_filename); if (_shower != null) { YankeeSpeed = _shower.YankeeSpeed; YankeeWidth = _shower.YankeeWidth; YankeeDiameter = _shower.YankeeDiameter; DwellDistance = _shower.DwellDistance; OperatingPressure = _shower.OperatingPressure; ShowerTemperature = _shower.ShowerTemperature; CoverageColour = _shower.CoverageColour; Nozzles.Clear(); int ctr = 0; NozzleControl nc; foreach (SerializedNozzle _sernozzle in _shower.Nozzles) { ctr++; nc = new NozzleControl { NozzleID = ctr, NozzleOrificeID = _sernozzle.NozzleOrificeID, NozzleSpacing = _sernozzle.NozzleSpacing, NozzleToYankee = _sernozzle.NozzleToYankee, SprayRotation = _sernozzle.SprayRotation, SprayAngle = _sernozzle.SprayAngle, NozzlePressure = _sernozzle.NozzlePressure, NozzleTypeName = _sernozzle.NozzleTypeName, NozzleSprayWidth = _sernozzle.NozzleSprayWidth, MaximumSprayAngle = _sernozzle.MaximumSprayAngle, NozzleFlow = _sernozzle.NozzleFlow, SprayPattern = _sernozzle.SprayPattern, NozzleTypes = NozzleTypes }; Nozzles.Add(nc); } NumberNozzles = ctr; MenuItems = MRUList.AddFile(MenuItems, _filename, OpenShowerFile); } else { //MenuItems = MRUList.RemoveFile(MenuItems, _filename); MessageBox.Show("The shower file appears to be corrupted and cannot be loaded.", "Unable to load shower file", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } } catch { //MenuItems = MRUList.RemoveFile(MenuItems, _filename); MessageBox.Show("The shower file appears to be corrupted and cannot be loaded.", "Unable to load shower file", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } } else { MenuItems = MRUList.RemoveFile(MenuItems, _filename); } }