protected override void ValidatingHandler(object sender, System.ComponentModel.CancelEventArgs e) { Ejector ejector = this.EjectorCtrl.Ejector; 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 = ejector.SpecifyName(this.textBoxName.Text); if (error != null) { UI.ShowError(error); } } } } }
public EjectorControl(Flowsheet flowsheet, Point location, Ejector ejector) : base(flowsheet, location, ejector) { InitializeComponent(); this.Size = new System.Drawing.Size(UI.UNIT_OP_CTRL_H, UI.UNIT_OP_CTRL_H); UI.SetStatusColor(this, this.Ejector.SolveState); this.UpdateBackImage(); }
public EjectorEditor(EjectorControl ejectorCtrl) : base(ejectorCtrl) { // // Required for Windows Form Designer support // //InitializeComponent(); this.inConstruction = true; Ejector ejector = this.EjectorCtrl.Ejector; this.Text = "Ejector: " + ejector.Name; this.UpdateStreamsUI(); //this.groupBoxEjector = new System.Windows.Forms.GroupBox(); //this.groupBoxEjector.Location = new System.Drawing.Point(452, 24); //this.groupBoxEjector.Name = "groupBoxEjector"; //this.groupBoxEjector.Text = "Ejector"; //this.groupBoxEjector.Size = new System.Drawing.Size(280, 100); //this.groupBoxEjector.TabIndex = 127; //this.groupBoxEjector.TabStop = false; //this.panel.Controls.Add(this.groupBoxEjector); //EjectorLabelsControl ejectorLabelsCtrl = new EjectorLabelsControl(this.EjectorCtrl.Ejector); //this.groupBoxEjector.Controls.Add(ejectorLabelsCtrl); //ejectorLabelsCtrl.Location = new Point(4, 12 + 20 + 2); //EjectorValuesControl ejectorValuesCtrl = new EjectorValuesControl(this.EjectorCtrl); //this.groupBoxEjector.Controls.Add(ejectorValuesCtrl); //ejectorValuesCtrl.Location = new Point(196, 12 + 20 + 2); ejectorCtrl.Ejector.StreamAttached += new StreamAttachedEventHandler(Ejector_StreamAttached); ejectorCtrl.Ejector.StreamDetached += new StreamDetachedEventHandler(Ejector_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(310, 8); 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(502, 8); 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.namePanel.Controls.Add(this.labelCalculationType); this.namePanel.Controls.Add(this.comboBoxCalculationType); this.comboBoxCalculationType.SelectedIndex = -1; comboBoxCalculationType.Enabled = false; // TODO: remove later initializeGrid(ejectorCtrl, columnIndex, false, "Ejector"); this.inConstruction = false; this.SetCalculationType(this.EjectorCtrl.Ejector.CalculationType); }
private void UpdateStreamsUI() { // clear the streams boxes and start again // this.groupBoxMotiveSuction.Controls.Clear(); Ejector ejector = this.EjectorCtrl.Ejector; bool hasMotiveIn = false; bool hasSuctionIn = false; bool hasDischargeOut = false; ProcessStreamBase motiveIn = ejector.MotiveInlet; if (motiveIn != null) { hasMotiveIn = true; } ProcessStreamBase suctionIn = ejector.SuctionInlet; if (suctionIn != null) { hasSuctionIn = true; } ProcessStreamBase dischargeOut = ejector.DischargeOutlet; if (dischargeOut != null) { hasDischargeOut = true; } //if (hasMotiveIn || hasSuctionIn || hasDischargeOut) //{ // ProcessStreamBase labelsStream = null; // if (hasMotiveIn) // labelsStream = motiveIn; // else if (hasSuctionIn) // labelsStream = suctionIn; // else if (hasDischargeOut) // labelsStream = dischargeOut; // UserControl ctrl = null; // if (labelsStream is ProcessStream) // { // ctrl = new ProcessStreamLabelsControl((ProcessStream)labelsStream); // } // else if (labelsStream is DryingGasStream) // { // ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); // } // else if (labelsStream is DryingMaterialStream) // { // ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream); // } // this.groupBoxMotiveSuction.Controls.Add(ctrl); // ctrl.Location = new Point(4, 12 + 20 + 2); //} if (hasMotiveIn) { ProcessStreamBaseControl processInCtrl = (ProcessStreamBaseControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.MotiveInlet.Name); initializeGrid(processInCtrl, columnIndex, false, "Motive/Suction Inlets,Discharge Outlet"); columnIndex += 2; if (hasSuctionIn) { processInCtrl = (ProcessStreamBaseControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.SuctionInlet.Name); initializeGrid(processInCtrl, columnIndex, true, "Motive/Suction Inlets,Discharge Outlet"); columnIndex++; } if (hasDischargeOut) { ProcessStreamBaseControl processOutCtrl = (ProcessStreamBaseControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name); initializeGrid(processOutCtrl, columnIndex, true, "Motive/Suction Inlets,Discharge Outlet"); columnIndex++; } //this.textBoxMotiveInName.Text = ejector.MotiveInlet.Name; //UI.SetStatusColor(this.textBoxMotiveInName, ejector.MotiveInlet.SolveState); } else if (hasSuctionIn) { ProcessStreamBaseControl processInCtrl = (ProcessStreamBaseControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.SuctionInlet.Name); initializeGrid(processInCtrl, columnIndex, false, "Motive/Suction Inlets,Discharge Outlet"); columnIndex += 2; if (hasDischargeOut) { ProcessStreamBaseControl processOutCtrl = (ProcessStreamBaseControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name); initializeGrid(processOutCtrl, columnIndex, true, "Motive/Suction Inlets,Discharge Outlet"); columnIndex++; } //this.textBoxSuctionInName.Text = ejector.SuctionInlet.Name; //UI.SetStatusColor(this.textBoxSuctionInName, ejector.SuctionInlet.SolveState); } else if (hasDischargeOut) { ProcessStreamBaseControl processOutCtrl = (ProcessStreamBaseControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name); initializeGrid(processOutCtrl, columnIndex, false, "Motive/Suction Inlets,Discharge Outlet"); columnIndex += 2; //this.textBoxDischargeOutName.Text = ejector.DischargeOutlet.Name; //UI.SetStatusColor(this.textBoxDischargeOutName, ejector.DischargeOutlet.SolveState); } }
private void UpdateStreamsUI() { // clear the streams boxes and start again this.groupBoxMotiveSuction.Controls.Clear(); Ejector ejector = this.EjectorCtrl.Ejector; bool hasMotiveIn = false; bool hasSuctionIn = false; bool hasDischargeOut = false; ProcessStreamBase motiveIn = ejector.MotiveInlet; if (motiveIn != null) { hasMotiveIn = true; } ProcessStreamBase suctionIn = ejector.SuctionInlet; if (suctionIn != null) { hasSuctionIn = true; } ProcessStreamBase dischargeOut = ejector.DischargeOutlet; if (dischargeOut != null) { hasDischargeOut = true; } if (hasMotiveIn || hasSuctionIn || hasDischargeOut) { ProcessStreamBase labelsStream = null; if (hasMotiveIn) { labelsStream = motiveIn; } else if (hasSuctionIn) { labelsStream = suctionIn; } else if (hasDischargeOut) { labelsStream = dischargeOut; } UserControl ctrl = null; if (labelsStream is ProcessStream) { ctrl = new ProcessStreamLabelsControl((ProcessStream)labelsStream); } else if (labelsStream is DryingGasStream) { ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); } else if (labelsStream is DryingMaterialStream) { ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream); } this.groupBoxMotiveSuction.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasMotiveIn) { UserControl ctrl = null; if (motiveIn is ProcessStream) { ProcessStreamControl processInCtrl = (ProcessStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.MotiveInlet.Name); ctrl = new ProcessStreamValuesControl(processInCtrl); } else if (motiveIn is DryingGasStream) { GasStreamControl gasInCtrl = (GasStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.MotiveInlet.Name); ctrl = new GasStreamValuesControl(gasInCtrl); } else if (motiveIn is DryingMaterialStream) { MaterialStreamControl materialInCtrl = (MaterialStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.MotiveInlet.Name); ctrl = new MaterialStreamValuesControl(materialInCtrl); } this.groupBoxMotiveSuction.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxMotiveInName.SetSolvable(ejector.MotiveInlet); this.groupBoxMotiveSuction.Controls.Add(this.textBoxMotiveInName); this.textBoxMotiveInName.Text = ejector.MotiveInlet.Name; UI.SetStatusColor(this.textBoxMotiveInName, ejector.MotiveInlet.SolveState); } if (hasSuctionIn) { UserControl ctrl = null; if (suctionIn is ProcessStream) { ProcessStreamControl processInCtrl = (ProcessStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.SuctionInlet.Name); ctrl = new ProcessStreamValuesControl(processInCtrl); } else if (suctionIn is DryingGasStream) { GasStreamControl gasInCtrl = (GasStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.SuctionInlet.Name); ctrl = new GasStreamValuesControl(gasInCtrl); } else if (suctionIn is DryingMaterialStream) { MaterialStreamControl materialInCtrl = (MaterialStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.SuctionInlet.Name); ctrl = new MaterialStreamValuesControl(materialInCtrl); } this.groupBoxMotiveSuction.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxSuctionInName.SetSolvable(ejector.SuctionInlet); this.groupBoxMotiveSuction.Controls.Add(this.textBoxSuctionInName); this.textBoxSuctionInName.Text = ejector.SuctionInlet.Name; UI.SetStatusColor(this.textBoxSuctionInName, ejector.SuctionInlet.SolveState); } if (hasDischargeOut) { UserControl ctrl = null; if (dischargeOut is ProcessStream) { ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name); ctrl = new ProcessStreamValuesControl(processOutCtrl); } else if (dischargeOut is DryingMaterialStream) { MaterialStreamControl matOutCtrl = (MaterialStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name); ctrl = new MaterialStreamValuesControl(matOutCtrl); } else if (dischargeOut is DryingGasStream) { GasStreamControl gasOutCtrl = (GasStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name); ctrl = new GasStreamValuesControl(gasOutCtrl); } this.groupBoxMotiveSuction.Controls.Add(ctrl); ctrl.Location = new Point(356, 12 + 20 + 2); this.textBoxDischargeOutName.SetSolvable(ejector.DischargeOutlet); this.groupBoxMotiveSuction.Controls.Add(this.textBoxDischargeOutName); this.textBoxDischargeOutName.Text = ejector.DischargeOutlet.Name; UI.SetStatusColor(this.textBoxDischargeOutName, ejector.DischargeOutlet.SolveState); } }
public EjectorLabelsControl(Ejector uo) : this() { this.InitializeVariableLabels(uo); }
public void InitializeVariableLabels(Ejector uo) { this.labelEntrainmentRatio.InitializeVariable(uo.EntrainmentRatio); this.labelCompressionRatio.InitializeVariable(uo.CompressionRatio); this.labelSuctionMotivePressureRatio.InitializeVariable(uo.SuctionMotivePressureRatio); }
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); }
public EjectorControl(Flowsheet flowsheet, Point location, Ejector ejector) : base(flowsheet, location, ejector) { }
//private void Ejector_StreamAttached(UnitOperation uo, ProcessStreamBase ps, int desc) { // this.UpdateStreamsUI(); //} //private void Ejector_StreamDetached(UnitOperation uo, ProcessStreamBase ps) { // this.UpdateStreamsUI(); //} protected override void UpdateStreamsUI() { // clear the streams boxes and start again this.groupBoxMotiveSuction.Controls.Clear(); Ejector ejector = this.EjectorCtrl.Ejector; bool hasMotiveIn = false; bool hasSuctionIn = false; bool hasDischargeOut = false; ProcessStreamBase motiveIn = ejector.MotiveInlet; hasMotiveIn = motiveIn != null; ProcessStreamBase suctionIn = ejector.SuctionInlet; hasSuctionIn = suctionIn != null; ProcessStreamBase dischargeOut = ejector.DischargeOutlet; hasDischargeOut = dischargeOut != null; if (hasMotiveIn || hasSuctionIn || hasDischargeOut) { ProcessStreamBase labelsStream = null; if (hasMotiveIn) { labelsStream = motiveIn; } else if (hasSuctionIn) { labelsStream = suctionIn; } else if (hasDischargeOut) { labelsStream = dischargeOut; } UserControl ctrl = null; if (labelsStream is WaterStream) { ctrl = new ProcessVarLabelsControl(labelsStream.VarList); } else if (labelsStream is DryingGasStream) { ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); } else if (labelsStream is DryingMaterialStream) { ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream); } //UserControl ctrl = new ProcessVarLabelsControl(labelsStream.VarList); this.groupBoxMotiveSuction.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasMotiveIn) { ProcessStreamBaseControl baseCtrl = this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.MotiveInlet.Name); UserControl ctrl = null; if (motiveIn is WaterStream) { ctrl = new ProcessVarValuesControl(baseCtrl); } else if (motiveIn is DryingGasStream) { ctrl = new GasStreamValuesControl((GasStreamControl)baseCtrl); } else if (motiveIn is DryingMaterialStream) { ctrl = new MaterialStreamValuesControl((MaterialStreamControl)baseCtrl); } //UserControl ctrl = new ProcessVarValuesControl(baseCtrl); this.groupBoxMotiveSuction.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxMotiveInName.SetSolvable(ejector.MotiveInlet); this.groupBoxMotiveSuction.Controls.Add(this.textBoxMotiveInName); this.textBoxMotiveInName.Text = ejector.MotiveInlet.Name; UI.SetStatusColor(this.textBoxMotiveInName, ejector.MotiveInlet.SolveState); } if (hasSuctionIn) { ProcessStreamBaseControl baseCtrl = this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.SuctionInlet.Name); UserControl ctrl = null; if (suctionIn is WaterStream) { ctrl = new ProcessVarValuesControl(baseCtrl); } else if (suctionIn is DryingGasStream) { ctrl = new GasStreamValuesControl((GasStreamControl)baseCtrl); } else if (suctionIn is DryingMaterialStream) { ctrl = new MaterialStreamValuesControl((MaterialStreamControl)baseCtrl); } //UserControl ctrl = new ProcessVarValuesControl(baseCtrl); this.groupBoxMotiveSuction.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxSuctionInName.SetSolvable(ejector.SuctionInlet); this.groupBoxMotiveSuction.Controls.Add(this.textBoxSuctionInName); this.textBoxSuctionInName.Text = ejector.SuctionInlet.Name; UI.SetStatusColor(this.textBoxSuctionInName, ejector.SuctionInlet.SolveState); } if (hasDischargeOut) { ProcessStreamBaseControl baseCtrl = this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name); UserControl ctrl = null; if (dischargeOut is WaterStream) { ctrl = new ProcessVarValuesControl(baseCtrl); } else if (dischargeOut is DryingMaterialStream) { ctrl = new MaterialStreamValuesControl((MaterialStreamControl)baseCtrl); } else if (dischargeOut is DryingGasStream) { ctrl = new GasStreamValuesControl((GasStreamControl)baseCtrl); } //UserControl ctrl = new ProcessVarValuesControl(baseCtrl); this.groupBoxMotiveSuction.Controls.Add(ctrl); ctrl.Location = new Point(356, 12 + 20 + 2); this.textBoxDischargeOutName.SetSolvable(ejector.DischargeOutlet); this.groupBoxMotiveSuction.Controls.Add(this.textBoxDischargeOutName); this.textBoxDischargeOutName.Text = ejector.DischargeOutlet.Name; UI.SetStatusColor(this.textBoxDischargeOutName, ejector.DischargeOutlet.SolveState); } }