protected override void ValidatingHandler(object sender, System.ComponentModel.CancelEventArgs e) { ScrubberCondenser scrubberCondenser = this.ScrubberCondenserCtrl.ScrubberCondenser; TextBox tb = (TextBox)sender; if (tb.Text != null) { if (tb.Text.Trim().Equals("")) { if (sender == this.textBoxName) { e.Cancel = true; string message3 = "Please specify a name!"; MessageBox.Show(message3, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { if (sender == this.textBoxName) { ErrorMessage error = scrubberCondenser.SpecifyName(this.textBoxName.Text); if (error != null) { UI.ShowError(error); } } } } }
private void UpdateStreamsUI() { // clear the streams boxes and start again //this.groupBoxGasInletOutlet.Controls.Clear(); //this.groupBoxLiquidOutlet.Controls.Clear(); ScrubberCondenser scrubberCondenser = this.ScrubberCondenserCtrl.ScrubberCondenser; bool hasGasIn = false; bool hasGasOut = false; bool hasLiquidOut = false; ProcessStreamBase gasIn = scrubberCondenser.GasInlet; if (gasIn != null) { hasGasIn = true; } ProcessStreamBase gasOut = scrubberCondenser.GasOutlet; if (gasOut != null) { hasGasOut = true; } ProcessStreamBase liquidOut = scrubberCondenser.LiquidOutlet; if (liquidOut != null) { hasLiquidOut = true; } if (hasGasIn) { ProcessStreamBaseControl processInCtrl = (ProcessStreamBaseControl)this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.GasInlet.Name); initializeGrid(processInCtrl, columnIndex, false, "Gas Inlet/Outlet"); columnIndex += 2; if (hasGasOut) { ProcessStreamBaseControl processOutCtrl = (ProcessStreamBaseControl)this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.GasOutlet.Name); initializeGrid(processOutCtrl, columnIndex, true, "Gas Inlet/Outlet"); columnIndex++; } } else if (hasGasOut) { ProcessStreamBaseControl processOutCtrl = (ProcessStreamBaseControl)this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.GasOutlet.Name); initializeGrid(processOutCtrl, columnIndex, false, "Gas Inlet/Outlet"); columnIndex += 2; } if (hasLiquidOut) { ProcessStreamBaseControl processOutCtrl = (ProcessStreamBaseControl)this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.LiquidOutlet.Name); initializeGrid(processOutCtrl, columnIndex, false, "Liquid Outlet"); columnIndex += 2; } }
public ScrubberCondenserControl(Flowsheet flowsheet, Point location, ScrubberCondenser scrubberCondenser) : base(flowsheet, location, scrubberCondenser) { InitializeComponent(); this.Size = new System.Drawing.Size(UI.UNIT_OP_CTRL_H, UI.UNIT_OP_CTRL_H); UI.SetStatusColor(this, this.ScrubberCondenser.SolveState); this.UpdateBackImage(); }
public void InitializeVariableLabels(ScrubberCondenser uo) { this.labelGasPressureDrop.InitializeVariable(uo.GasPressureDrop); this.labelCollectionEfficiency.InitializeVariable(uo.CollectionEfficiency); this.labelInletParticleLoading.InitializeVariable(uo.InletParticleLoading); this.labelOutletParticleLoading.InitializeVariable(uo.OutletParticleLoading); this.labelParticleCollectionRate.InitializeVariable(uo.ParticleCollectionRate); this.labelMassFlowRateOfParticleLostToGasOutlet.InitializeVariable(uo.MassFlowRateOfParticleLostToGasOutlet); this.labelCoolingDuty.InitializeVariable(uo.CoolingDuty); this.labelLiquidToGasRatio.InitializeVariable(uo.LiquidToGasRatio); this.labelLiquidRecirculationMassFlowRate.InitializeVariable(uo.LiquidRecirculationMassFlowRate); this.labelLiquidRecirculationVolumeFlowRate.InitializeVariable(uo.LiquidRecirculationVolumeFlowRate); }
public ScrubberCondenserControl(Flowsheet flowsheet, Point location, ScrubberCondenser scrubberCondenser) : base(flowsheet, location, scrubberCondenser) { }
public ScrubberCondenserEditor(ScrubberCondenserControl scrubberCondenserCtrl) : base(scrubberCondenserCtrl) { // // Required for Windows Form Designer support // InitializeComponent(); this.inConstruction = true; ScrubberCondenser scrubberCondenser = this.ScrubberCondenserCtrl.ScrubberCondenser; this.Text = "Scrubber Condenser: " + scrubberCondenser.Name; this.UpdateStreamsUI(); this.groupBoxScrubberCondenser = new System.Windows.Forms.GroupBox(); this.groupBoxScrubberCondenser.Location = new System.Drawing.Point(644, 24); //this.groupBoxScrubberCondenser.Location = new System.Drawing.Point(1010, 24); this.groupBoxScrubberCondenser.Name = "groupBoxScrubberCondenser"; this.groupBoxScrubberCondenser.Text = "Scrubber Condenser"; this.groupBoxScrubberCondenser.Size = new System.Drawing.Size(280, 240); this.groupBoxScrubberCondenser.TabIndex = 127; this.groupBoxScrubberCondenser.TabStop = false; this.panel.Controls.Add(this.groupBoxScrubberCondenser); this.groupBoxLiquidOutlet.Size = new System.Drawing.Size(280, 300); //this.panel.Size = new System.Drawing.Size(1010, 329); //this.ClientSize = new System.Drawing.Size(1010, 351); // this.panel.Size = new System.Drawing.Size(1292, 329); // this.ClientSize = new System.Drawing.Size(1292, 351); ProcessVarLabelsControl scrubberCondenserLabelsCtrl = new ProcessVarLabelsControl(this.ScrubberCondenserCtrl.ScrubberCondenser.VarList); this.groupBoxScrubberCondenser.Controls.Add(scrubberCondenserLabelsCtrl); scrubberCondenserLabelsCtrl.Location = new Point(4, 12 + 20 + 2); ProcessVarValuesControl scrubberCondenserValuesCtrl = new ProcessVarValuesControl(this.ScrubberCondenserCtrl); this.groupBoxScrubberCondenser.Controls.Add(scrubberCondenserValuesCtrl); scrubberCondenserValuesCtrl.Location = new Point(196, 12 + 20 + 2); scrubberCondenserCtrl.ScrubberCondenser.StreamAttached += new StreamAttachedEventHandler(ScrubberCondenser_StreamAttached); scrubberCondenserCtrl.ScrubberCondenser.StreamDetached += new StreamDetachedEventHandler(ScrubberCondenser_StreamDetached); this.menuItemRating = new MenuItem(); this.menuItemRating.Index = this.menuItemReport.Index + 1; this.menuItemRating.Text = "Rating"; this.menuItemRating.Click += new EventHandler(menuItemRating_Click); this.mainMenu.MenuItems.Add(this.menuItemRating); this.labelCalculationType = new System.Windows.Forms.Label(); this.comboBoxCalculationType = new System.Windows.Forms.ComboBox(); // labelCalculationType this.labelCalculationType.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.labelCalculationType.Location = new System.Drawing.Point(300, 0); this.labelCalculationType.Name = "labelCalculationType"; this.labelCalculationType.BackColor = Color.DarkGray; this.labelCalculationType.Size = new System.Drawing.Size(192, 20); this.labelCalculationType.TabIndex = 5; this.labelCalculationType.Text = "Calculation Type:"; this.labelCalculationType.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // comboBoxCalculationType this.comboBoxCalculationType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxCalculationType.Items.AddRange(new object[] { "Balance", "Rating" }); this.comboBoxCalculationType.Location = new System.Drawing.Point(492, 0); this.comboBoxCalculationType.Name = "comboBoxCalculationType"; this.comboBoxCalculationType.Size = new System.Drawing.Size(80, 21); this.comboBoxCalculationType.TabIndex = 7; this.comboBoxCalculationType.SelectedIndexChanged += new EventHandler(comboBoxCalculationType_SelectedIndexChanged); this.panel.Controls.Add(this.labelCalculationType); this.panel.Controls.Add(this.comboBoxCalculationType); this.comboBoxCalculationType.SelectedIndex = -1; comboBoxCalculationType.Enabled = false; // TODO: remove later this.inConstruction = false; this.SetCalculationType(this.ScrubberCondenserCtrl.ScrubberCondenser.CalculationType); }
private void UpdateStreamsUI() { // clear the streams boxes and start again this.groupBoxGasInletOutlet.Controls.Clear(); this.groupBoxLiquidOutlet.Controls.Clear(); this.groupBoxWaterInletOutlet.Controls.Clear(); ScrubberCondenser scrubberCondenser = this.ScrubberCondenserCtrl.ScrubberCondenser; bool hasGasIn = false; bool hasGasOut = false; bool hasLiquidOut = false; bool hasWaterIn = false; bool hasWaterOut = false; ProcessStreamBase gasIn = scrubberCondenser.GasInlet; hasGasIn = gasIn != null; ProcessStreamBase gasOut = scrubberCondenser.GasOutlet; hasGasOut = gasOut != null; ProcessStreamBase liquidOut = scrubberCondenser.LiquidOutlet; hasLiquidOut = liquidOut != null; ProcessStreamBase waterIn = scrubberCondenser.WaterInlet; hasWaterIn = waterIn != null; ProcessStreamBase waterOut = scrubberCondenser.WaterOutlet; hasWaterOut = waterOut != null; if (hasGasIn || hasGasOut) { ProcessStreamBase labelsStream = hasGasIn ? gasIn : gasOut; //UserControl ctrl = new ProcessVarLabelsControl(labelsStream.VarList); UserControl ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); this.groupBoxGasInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasGasIn) { ProcessStreamBaseControl gasInCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.GasInlet.Name); //UserControl ctrl = new ProcessVarValuesControl(gasInCtrl); UserControl ctrl = new GasStreamValuesControl((GasStreamControl)gasInCtrl); this.groupBoxGasInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxGasInName.SetSolvable(scrubberCondenser.GasInlet); this.groupBoxGasInletOutlet.Controls.Add(this.textBoxGasInName); this.textBoxGasInName.Text = scrubberCondenser.GasInlet.Name; UI.SetStatusColor(this.textBoxGasInName, scrubberCondenser.GasInlet.SolveState); } if (hasGasOut) { ProcessStreamBaseControl gasOutCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.GasOutlet.Name); //UserControl ctrl = new ProcessVarValuesControl(gasOutCtrl); UserControl ctrl = new GasStreamValuesControl((GasStreamControl)gasOutCtrl); this.groupBoxGasInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxGasOutName.SetSolvable(scrubberCondenser.GasOutlet); this.groupBoxGasInletOutlet.Controls.Add(this.textBoxGasOutName); this.textBoxGasOutName.Text = scrubberCondenser.GasOutlet.Name; UI.SetStatusColor(this.textBoxGasOutName, scrubberCondenser.GasOutlet.SolveState); } if (hasLiquidOut) { // add the labels //UserControl ctrl = new ProcessVarLabelsControl(liquidOut.VarList); UserControl ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)liquidOut); this.groupBoxLiquidOutlet.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); ProcessStreamBaseControl matOutCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.LiquidOutlet.Name); //ctrl = new ProcessVarValuesControl(matOutCtrl); ctrl = new MaterialStreamValuesControl((MaterialStreamControl)matOutCtrl); this.groupBoxLiquidOutlet.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxLiquidOutName.SetSolvable(scrubberCondenser.LiquidOutlet); this.groupBoxLiquidOutlet.Controls.Add(this.textBoxLiquidOutName); this.textBoxLiquidOutName.Text = scrubberCondenser.LiquidOutlet.Name; UI.SetStatusColor(this.textBoxLiquidOutName, scrubberCondenser.LiquidOutlet.SolveState); } if (hasWaterIn || hasWaterOut) { UserControl ctrl = null; ProcessStreamBase labelsStream = hasWaterIn ? waterIn : waterOut; if (labelsStream is WaterStream) { ctrl = new ProcessVarLabelsControl(labelsStream.VarList); } else if (waterIn is DryingMaterialStream) { ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream); } if (ctrl != null) { this.groupBoxWaterInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } this.panel.Size = new System.Drawing.Size(1292, 329); this.ClientSize = new System.Drawing.Size(1292, 351); } else { this.panel.Size = new System.Drawing.Size(932, 329); this.ClientSize = new System.Drawing.Size(932, 351); } if (hasWaterIn) { UserControl ctrl = null; ProcessStreamBaseControl waterInCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.WaterInlet.Name); if (waterIn is WaterStream) { ctrl = new ProcessVarValuesControl(waterInCtrl); } else if (waterIn is DryingMaterialStream) { ctrl = new MaterialStreamValuesControl((MaterialStreamControl)waterInCtrl); } if (ctrl != null) { this.groupBoxWaterInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); } this.textBoxWaterInName.SetSolvable(scrubberCondenser.WaterInlet); this.groupBoxWaterInletOutlet.Controls.Add(this.textBoxWaterInName); this.textBoxWaterInName.Text = scrubberCondenser.WaterInlet.Name; UI.SetStatusColor(this.textBoxWaterInName, scrubberCondenser.WaterInlet.SolveState); } if (hasWaterOut) { UserControl ctrl = null; ProcessStreamBaseControl waterOutCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.WaterOutlet.Name); if (waterOut is WaterStream) { ctrl = new ProcessVarValuesControl(waterOutCtrl); } else if (waterOut is DryingMaterialStream) { ctrl = new MaterialStreamValuesControl((MaterialStreamControl)waterOutCtrl); } if (ctrl != null) { this.groupBoxWaterInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); } this.textBoxWaterOutName.SetSolvable(scrubberCondenser.WaterOutlet); this.groupBoxWaterInletOutlet.Controls.Add(this.textBoxWaterOutName); this.textBoxWaterOutName.Text = scrubberCondenser.WaterOutlet.Name; UI.SetStatusColor(this.textBoxWaterOutName, scrubberCondenser.WaterOutlet.SolveState); } }
private Flowsheet SetFlowsheetContent(NewProcessSettings newProcessSettings, ApplicationPreferences appPrefs, ArrayList items, string flowsheetName) { Flowsheet flowsheet = null; IEnumerator e = items.GetEnumerator(); while (e.MoveNext()) { object obj = e.Current; if (obj is EvaporationAndDryingSystem) { EvaporationAndDryingSystem persisted = (EvaporationAndDryingSystem)obj; persisted.SetSystemFileName(flowsheetName); // call this before SetObjectData() persisted.SetObjectData(); flowsheet = new Flowsheet(newProcessSettings, appPrefs, persisted); } else if (obj is GasStreamControl) { GasStreamControl persistedCtrl = (GasStreamControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); DryingGasStream stream = flowsheet.EvaporationAndDryingSystem.GetGasStream(solvableName); GasStreamControl newCtrl = new GasStreamControl(flowsheet, new Point(0, 0), stream); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is MaterialStreamControl) { MaterialStreamControl persistedCtrl = (MaterialStreamControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); DryingMaterialStream stream = flowsheet.EvaporationAndDryingSystem.GetMaterialStream(solvableName); MaterialStreamControl newCtrl = new MaterialStreamControl(flowsheet, new Point(0, 0), stream); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is DryerControl) { DryerControl persistedCtrl = (DryerControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Dryer uo = flowsheet.EvaporationAndDryingSystem.GetDryer(solvableName); DryerControl newCtrl = new DryerControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is HeatExchangerControl) { HeatExchangerControl persistedCtrl = (HeatExchangerControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); HeatExchanger uo = flowsheet.EvaporationAndDryingSystem.GetHeatExchanger(solvableName); HeatExchangerControl newCtrl = new HeatExchangerControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is CycloneControl) { CycloneControl persistedCtrl = (CycloneControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Cyclone uo = flowsheet.EvaporationAndDryingSystem.GetCyclone(solvableName); CycloneControl newCtrl = new CycloneControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is EjectorControl) { EjectorControl persistedCtrl = (EjectorControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Ejector uo = flowsheet.EvaporationAndDryingSystem.GetEjector(solvableName); EjectorControl newCtrl = new EjectorControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is WetScrubberControl) { WetScrubberControl persistedCtrl = (WetScrubberControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); WetScrubber uo = flowsheet.EvaporationAndDryingSystem.GetWetScrubber(solvableName); WetScrubberControl newCtrl = new WetScrubberControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is ScrubberCondenserControl) { ScrubberCondenserControl persistedCtrl = (ScrubberCondenserControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); ScrubberCondenser uo = flowsheet.EvaporationAndDryingSystem.GetScrubberCondenser(solvableName); ScrubberCondenserControl newCtrl = new ScrubberCondenserControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is MixerControl) { MixerControl persistedCtrl = (MixerControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Mixer uo = flowsheet.EvaporationAndDryingSystem.GetMixer(solvableName); MixerControl newCtrl = new MixerControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is TeeControl) { TeeControl persistedCtrl = (TeeControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Tee uo = flowsheet.EvaporationAndDryingSystem.GetTee(solvableName); TeeControl newCtrl = new TeeControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is FlashTankControl) { FlashTankControl persistedCtrl = (FlashTankControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); FlashTank uo = flowsheet.EvaporationAndDryingSystem.GetFlashTank(solvableName); FlashTankControl newCtrl = new FlashTankControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is FanControl) { FanControl persistedCtrl = (FanControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Fan uo = flowsheet.EvaporationAndDryingSystem.GetFan(solvableName); FanControl newCtrl = new FanControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is ValveControl) { ValveControl persistedCtrl = (ValveControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Valve uo = flowsheet.EvaporationAndDryingSystem.GetValve(solvableName); ValveControl newCtrl = new ValveControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is BagFilterControl) { BagFilterControl persistedCtrl = (BagFilterControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); BagFilter uo = flowsheet.EvaporationAndDryingSystem.GetBagFilter(solvableName); BagFilterControl newCtrl = new BagFilterControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is AirFilterControl) { AirFilterControl persistedCtrl = (AirFilterControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); AirFilter uo = flowsheet.EvaporationAndDryingSystem.GetAirFilter(solvableName); AirFilterControl newCtrl = new AirFilterControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is CompressorControl) { CompressorControl persistedCtrl = (CompressorControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Compressor uo = flowsheet.EvaporationAndDryingSystem.GetCompressor(solvableName); CompressorControl newCtrl = new CompressorControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is HeaterControl) { HeaterControl persistedCtrl = (HeaterControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Heater uo = flowsheet.EvaporationAndDryingSystem.GetHeater(solvableName); HeaterControl newCtrl = new HeaterControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is CoolerControl) { CoolerControl persistedCtrl = (CoolerControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Cooler uo = flowsheet.EvaporationAndDryingSystem.GetCooler(solvableName); CoolerControl newCtrl = new CoolerControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is ElectrostaticPrecipitatorControl) { ElectrostaticPrecipitatorControl persistedCtrl = (ElectrostaticPrecipitatorControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); ElectrostaticPrecipitator uo = flowsheet.EvaporationAndDryingSystem.GetElectrostaticPrecipitator(solvableName); ElectrostaticPrecipitatorControl newCtrl = new ElectrostaticPrecipitatorControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is PumpControl) { PumpControl persistedCtrl = (PumpControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Pump uo = flowsheet.EvaporationAndDryingSystem.GetPump(solvableName); PumpControl newCtrl = new PumpControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is RecycleControl) { RecycleControl persistedCtrl = (RecycleControl)obj; string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string)); Recycle uo = flowsheet.EvaporationAndDryingSystem.GetRecycle(solvableName); RecycleControl newCtrl = new RecycleControl(flowsheet, new Point(0, 0), uo); newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext); flowsheet.Controls.Add(newCtrl); } else if (obj is SolvableConnection) { SolvableConnection persistedDc = (SolvableConnection)obj; SolvableConnection dc = new SolvableConnection(flowsheet); dc.SetObjectData(persistedDc.SerializationInfo, persistedDc.StreamingContext); flowsheet.ConnectionManager.Connections.Add(dc); } else if (obj is FlowsheetPreferences) { FlowsheetPreferences flowsheetPrefs = obj as FlowsheetPreferences; flowsheetPrefs.SetObjectData(flowsheetPrefs.SerializationInfo, flowsheetPrefs.StreamingContext); flowsheet.BackColor = flowsheetPrefs.BackColor; } else if (obj is ProsimoUI.CustomEditor.CustomEditor) { ProsimoUI.CustomEditor.CustomEditor persistedEditor = (ProsimoUI.CustomEditor.CustomEditor)obj; flowsheet.CustomEditor.SetObjectData(persistedEditor.SerializationInfo, persistedEditor.StreamingContext); } } if (this.CheckFlowsheetVersion(items, flowsheet)) { flowsheet.IsDirty = false; } else { flowsheet = null; } return(flowsheet); }
private void UpdateStreamsUI() { // clear the streams boxes and start again this.groupBoxGasInletOutlet.Controls.Clear(); this.groupBoxLiquidOutlet.Controls.Clear(); ScrubberCondenser scrubberCondenser = this.ScrubberCondenserCtrl.ScrubberCondenser; bool hasGasIn = false; bool hasGasOut = false; bool hasLiquidOut = false; ProcessStreamBase gasIn = scrubberCondenser.GasInlet; if (gasIn != null) { hasGasIn = true; } ProcessStreamBase gasOut = scrubberCondenser.GasOutlet; if (gasOut != null) { hasGasOut = true; } ProcessStreamBase liquidOut = scrubberCondenser.LiquidOutlet; if (liquidOut != null) { hasLiquidOut = true; } if (hasGasIn || hasGasOut) { ProcessStreamBase labelsStream = null; if (hasGasIn) { labelsStream = gasIn; } else if (hasGasOut) { labelsStream = gasOut; } UserControl ctrl = null; if (labelsStream is ProcessStream) { ctrl = new ProcessStreamLabelsControl((ProcessStream)labelsStream); } else if (labelsStream is DryingGasStream) { ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); } this.groupBoxGasInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasGasIn) { UserControl ctrl = null; if (gasIn is ProcessStream) { ProcessStreamControl processInCtrl = (ProcessStreamControl)this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.GasInlet.Name); ctrl = new ProcessStreamValuesControl(processInCtrl); } else if (gasIn is DryingGasStream) { GasStreamControl gasInCtrl = (GasStreamControl)this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.GasInlet.Name); ctrl = new GasStreamValuesControl(gasInCtrl); } this.groupBoxGasInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxGasInName.SetSolvable(scrubberCondenser.GasInlet); this.groupBoxGasInletOutlet.Controls.Add(this.textBoxGasInName); this.textBoxGasInName.Text = scrubberCondenser.GasInlet.Name; UI.SetStatusColor(this.textBoxGasInName, scrubberCondenser.GasInlet.SolveState); } if (hasGasOut) { UserControl ctrl = null; if (gasOut is ProcessStream) { ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.GasOutlet.Name); ctrl = new ProcessStreamValuesControl(processOutCtrl); } else if (gasOut is DryingGasStream) { GasStreamControl gasOutCtrl = (GasStreamControl)this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.GasOutlet.Name); ctrl = new GasStreamValuesControl(gasOutCtrl); } this.groupBoxGasInletOutlet.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxGasOutName.SetSolvable(scrubberCondenser.GasOutlet); this.groupBoxGasInletOutlet.Controls.Add(this.textBoxGasOutName); this.textBoxGasOutName.Text = scrubberCondenser.GasOutlet.Name; UI.SetStatusColor(this.textBoxGasOutName, scrubberCondenser.GasOutlet.SolveState); } if (hasLiquidOut) { // add the labels UserControl ctrl = null; if (liquidOut is ProcessStream) { ctrl = new ProcessStreamLabelsControl((ProcessStream)liquidOut); } else if (liquidOut is DryingMaterialStream) { ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)liquidOut); } this.groupBoxLiquidOutlet.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); // add the values ctrl = null; if (liquidOut is ProcessStream) { ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.LiquidOutlet.Name); ctrl = new ProcessStreamValuesControl(processOutCtrl); } else if (liquidOut is DryingMaterialStream) { MaterialStreamControl matOutCtrl = (MaterialStreamControl)this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.LiquidOutlet.Name); ctrl = new MaterialStreamValuesControl(matOutCtrl); } this.groupBoxLiquidOutlet.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxLiquidOutName.SetSolvable(scrubberCondenser.LiquidOutlet); this.groupBoxLiquidOutlet.Controls.Add(this.textBoxLiquidOutName); this.textBoxLiquidOutName.Text = scrubberCondenser.LiquidOutlet.Name; UI.SetStatusColor(this.textBoxLiquidOutName, scrubberCondenser.LiquidOutlet.SolveState); } }
public ScrubberCondenserLabelsControl(ScrubberCondenser uo) : this() { this.InitializeVariableLabels(uo); }