private void UpdateStreamsUI() { // clear the streams boxes and start again this.groupBoxStreams.Controls.Clear(); TwoStreamUnitOperation twoStreamUnitOp = this.TwoStreamUnitOpCtrl.TwoStreamUnitOp; bool hasStreamIn = false; bool hasStreamOut = false; ProcessStreamBase streamIn = twoStreamUnitOp.Inlet; hasStreamIn = streamIn != null; ProcessStreamBase streamOut = twoStreamUnitOp.Outlet; hasStreamOut = streamOut != null; if (hasStreamIn || hasStreamOut) { ProcessStreamBase labelsStream = hasStreamIn ? streamIn : streamOut; 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.groupBoxStreams.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasStreamIn) { ProcessStreamBaseControl myControl = this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Inlet.Name); UserControl ctrl = null; if (streamIn is WaterStream) { WaterStreamControl processInCtrl = (WaterStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Inlet.Name); ctrl = new ProcessVarValuesControl(processInCtrl); } else if (streamIn is DryingGasStream) { GasStreamControl gasInCtrl = (GasStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Inlet.Name); ctrl = new GasStreamValuesControl(gasInCtrl); } else if (streamIn is DryingMaterialStream) { MaterialStreamControl materialInCtrl = (MaterialStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Inlet.Name); ctrl = new MaterialStreamValuesControl(materialInCtrl); } //UserControl ctrl = new ProcessVarValuesControl(myControl); this.groupBoxStreams.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxStreamInName.SetSolvable(streamIn); this.groupBoxStreams.Controls.Add(this.textBoxStreamInName); this.textBoxStreamInName.Text = twoStreamUnitOp.Inlet.Name; UI.SetStatusColor(this.textBoxStreamInName, twoStreamUnitOp.Inlet.SolveState); } if (hasStreamOut) { ProcessStreamBaseControl baseControl = this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Outlet.Name); UserControl ctrl = null; if (streamOut is WaterStream) { WaterStreamControl processOutCtrl = (WaterStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Outlet.Name); ctrl = new ProcessVarValuesControl(processOutCtrl); } else if (streamOut is DryingGasStream) { GasStreamControl gasOutCtrl = (GasStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Outlet.Name); ctrl = new GasStreamValuesControl(gasOutCtrl); } else if (streamOut is DryingMaterialStream) { MaterialStreamControl materialOutCtrl = (MaterialStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Outlet.Name); ctrl = new MaterialStreamValuesControl(materialOutCtrl); } //UserControl ctrl = new ProcessVarValuesControl(baseControl); this.groupBoxStreams.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxStreamOutName.SetSolvable(streamOut); this.groupBoxStreams.Controls.Add(this.textBoxStreamOutName); this.textBoxStreamOutName.Text = twoStreamUnitOp.Outlet.Name; UI.SetStatusColor(this.textBoxStreamOutName, twoStreamUnitOp.Outlet.SolveState); } }
private void UpdateStreamsUI() { // clear the stream group-boxes and start again this.groupBoxColdStream.Controls.Clear(); this.groupBoxHotStream.Controls.Clear(); HeatExchanger heatExchanger = this.HeatExchangerCtrl.HeatExchanger; bool hasColdIn = false; bool hasColdOut = false; bool hasHotIn = false; bool hasHotOut = false; ProcessStreamBase coldIn = heatExchanger.ColdSideInlet; hasColdIn = coldIn != null; ProcessStreamBase coldOut = heatExchanger.ColdSideOutlet; hasColdOut = coldOut != null; ProcessStreamBase hotIn = heatExchanger.HotSideInlet; hasHotIn = hotIn != null; ProcessStreamBase hotOut = heatExchanger.HotSideOutlet; hasHotOut = hotOut != null; if (hasColdIn || hasColdOut) { ProcessStreamBase labelsStream = hasColdIn ? coldIn : coldOut; 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); } this.groupBoxColdStream.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasColdIn) { UserControl ctrl = null; ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.ColdSideInlet.Name); if (coldIn is WaterStream) { WaterStreamControl processInCtrl = baseCtrl as WaterStreamControl; ctrl = new ProcessVarValuesControl(processInCtrl); } else if (coldIn is DryingGasStream) { GasStreamControl gasInCtrl = baseCtrl as GasStreamControl; ctrl = new GasStreamValuesControl(gasInCtrl); } else if (coldIn is DryingMaterialStream) { MaterialStreamControl matInCtrl = baseCtrl as MaterialStreamControl; ctrl = new MaterialStreamValuesControl(matInCtrl); } this.groupBoxColdStream.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxColdInName.SetSolvable(heatExchanger.ColdSideInlet); this.groupBoxColdStream.Controls.Add(this.textBoxColdInName); this.textBoxColdInName.Text = heatExchanger.ColdSideInlet.Name; UI.SetStatusColor(this.textBoxColdInName, heatExchanger.ColdSideInlet.SolveState); } if (hasColdOut) { ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.ColdSideOutlet.Name); UserControl ctrl = null; if (coldOut is WaterStream) { WaterStreamControl processOutCtrl = baseCtrl as WaterStreamControl; ctrl = new ProcessVarValuesControl(processOutCtrl); } else if (coldOut is DryingGasStream) { GasStreamControl gasOutCtrl = baseCtrl as GasStreamControl; ctrl = new GasStreamValuesControl(gasOutCtrl); } else if (coldOut is DryingMaterialStream) { MaterialStreamControl matOutCtrl = baseCtrl as MaterialStreamControl; ctrl = new MaterialStreamValuesControl(matOutCtrl); } this.groupBoxColdStream.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxColdOutName.SetSolvable(heatExchanger.ColdSideOutlet); this.groupBoxColdStream.Controls.Add(this.textBoxColdOutName); this.textBoxColdOutName.Text = heatExchanger.ColdSideOutlet.Name; UI.SetStatusColor(this.textBoxColdOutName, heatExchanger.ColdSideOutlet.SolveState); } if (hasHotIn || hasHotOut) { ProcessStreamBase labelsStream = hasHotIn ? hotIn : hotOut; 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); } this.groupBoxHotStream.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasHotIn) { UserControl ctrl = null; ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.HotSideInlet.Name); if (hotIn is WaterStream) { WaterStreamControl processInCtrl = baseCtrl as WaterStreamControl; ctrl = new ProcessVarValuesControl(processInCtrl); } else if (hotIn is DryingGasStream) { GasStreamControl gasInCtrl = baseCtrl as GasStreamControl; ctrl = new GasStreamValuesControl(gasInCtrl); } else if (hotIn is DryingMaterialStream) { MaterialStreamControl matInCtrl = baseCtrl as MaterialStreamControl; ctrl = new MaterialStreamValuesControl(matInCtrl); } this.groupBoxHotStream.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxHotInName.SetSolvable(heatExchanger.HotSideInlet); this.groupBoxHotStream.Controls.Add(this.textBoxHotInName); this.textBoxHotInName.Text = heatExchanger.HotSideInlet.Name; UI.SetStatusColor(this.textBoxHotInName, heatExchanger.HotSideInlet.SolveState); } if (hasHotOut) { ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.HotSideOutlet.Name); UserControl ctrl = null; if (hotOut is WaterStream) { WaterStreamControl processOutCtrl = baseCtrl as WaterStreamControl; ctrl = new ProcessVarValuesControl(processOutCtrl); } else if (hotOut is DryingGasStream) { GasStreamControl gasOutCtrl = baseCtrl as GasStreamControl; ctrl = new GasStreamValuesControl(gasOutCtrl); } else if (hotOut is DryingMaterialStream) { MaterialStreamControl matOutCtrl = baseCtrl as MaterialStreamControl; ctrl = new MaterialStreamValuesControl(matOutCtrl); } this.groupBoxHotStream.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxHotOutName.SetSolvable(heatExchanger.HotSideOutlet); this.groupBoxHotStream.Controls.Add(this.textBoxHotOutName); this.textBoxHotOutName.Text = heatExchanger.HotSideOutlet.Name; UI.SetStatusColor(this.textBoxHotOutName, heatExchanger.HotSideOutlet.SolveState); } }
private void UpdateStreamsUI() { // clear the stream group-boxes and start again this.groupBoxGasStream.Controls.Clear(); this.groupBoxLiquidStream.Controls.Clear(); WetScrubber wetScrubber = this.WetScrubberCtrl.WetScrubber; bool hasGasIn = false; bool hasGasOut = false; bool hasLiquidIn = false; bool hasLiquidOut = false; ProcessStreamBase gasIn = wetScrubber.GasInlet; hasGasIn = gasIn != null; ProcessStreamBase gasOut = wetScrubber.GasOutlet; hasGasOut = gasOut != null; ProcessStreamBase liquidIn = wetScrubber.LiquidInlet; hasLiquidIn = liquidIn != null; ProcessStreamBase liquidOut = wetScrubber.LiquidOutlet; hasLiquidOut = liquidOut != null; if (hasGasIn || hasGasOut) { ProcessStreamBase labelsStream = null; if (hasGasIn) { labelsStream = gasIn; } else if (hasGasOut) { labelsStream = gasOut; } UserControl ctrl = null; //UserControl ctrl = new ProcessVarLabelsControl(labelsStream.VarList); if (labelsStream is DryingGasStream) { ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); } this.groupBoxGasStream.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasGasIn) { ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.GasInlet.Name); UserControl ctrl = null; //UserControl ctrl = new ProcessVarValuesControl(baseCtrl); if (gasIn is DryingGasStream) { GasStreamControl gasInCtrl = baseCtrl as GasStreamControl; ctrl = new GasStreamValuesControl(gasInCtrl); } this.groupBoxGasStream.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxGasInName.SetSolvable(wetScrubber.GasInlet); this.groupBoxGasStream.Controls.Add(this.textBoxGasInName); this.textBoxGasInName.Text = wetScrubber.GasInlet.Name; UI.SetStatusColor(this.textBoxGasInName, wetScrubber.GasInlet.SolveState); } if (hasGasOut) { ProcessStreamBaseControl baseCtrl = this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.GasOutlet.Name); UserControl ctrl = null; //UserControl ctrl = new ProcessVarValuesControl(baseCtrl); if (gasOut is DryingGasStream) { GasStreamControl gasOutCtrl = baseCtrl as GasStreamControl; ctrl = new GasStreamValuesControl(gasOutCtrl); } this.groupBoxGasStream.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxGasOutName.SetSolvable(wetScrubber.GasOutlet); this.groupBoxGasStream.Controls.Add(this.textBoxGasOutName); this.textBoxGasOutName.Text = wetScrubber.GasOutlet.Name; UI.SetStatusColor(this.textBoxGasOutName, wetScrubber.GasOutlet.SolveState); } if (hasLiquidIn || hasLiquidOut) { ProcessStreamBase labelsStream = null; if (hasLiquidIn) { labelsStream = liquidIn; } else if (hasLiquidOut) { labelsStream = liquidOut; } UserControl ctrl = null; //if (labelsStream is WaterStream) { // ctrl = new ProcessVarLabelsControl(labelsStream.VarList); //} //else if (labelsStream is DryingGasStream) //{ // ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream); //} if (labelsStream is DryingMaterialStream) { ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream); } //UserControl ctrl = new ProcessVarLabelsControl(labelsStream.VarList); this.groupBoxLiquidStream.Controls.Add(ctrl); ctrl.Location = new Point(4, 12 + 20 + 2); } if (hasLiquidIn) { ProcessStreamBaseControl baseCtrl = this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.LiquidInlet.Name); UserControl ctrl = null; if (liquidIn is WaterStream) { WaterStreamControl processInCtrl = baseCtrl as WaterStreamControl; ctrl = new ProcessVarValuesControl(processInCtrl); } //else if (liquidIn is DryingGasStream) //{ // GasStreamControl gasInCtrl = baseCtrl as GasStreamControl; // ctrl = new GasStreamValuesControl(gasInCtrl); //} else if (liquidIn is DryingMaterialStream) { MaterialStreamControl matInCtrl = baseCtrl as MaterialStreamControl; ctrl = new MaterialStreamValuesControl(matInCtrl); } //UserControl ctrl = new ProcessVarValuesControl(baseCtrl); this.groupBoxLiquidStream.Controls.Add(ctrl); ctrl.Location = new Point(196, 12 + 20 + 2); this.textBoxLiquidInName.SetSolvable(wetScrubber.LiquidInlet); this.groupBoxLiquidStream.Controls.Add(this.textBoxLiquidInName); this.textBoxLiquidInName.Text = wetScrubber.LiquidInlet.Name; UI.SetStatusColor(this.textBoxLiquidInName, wetScrubber.LiquidInlet.SolveState); } if (hasLiquidOut) { ProcessStreamBaseControl baseCtrl = this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.LiquidOutlet.Name); UserControl ctrl = null; //else if (liquidOut is DryingGasStream) { // GasStreamControl gasOutCtrl = baseCtrl as GasStreamControl; // ctrl = new GasStreamValuesControl(gasOutCtrl); //} if (liquidOut is DryingMaterialStream) { MaterialStreamControl matOutCtrl = baseCtrl as MaterialStreamControl; ctrl = new MaterialStreamValuesControl(matOutCtrl); } //UserControl ctrl = new ProcessVarValuesControl(baseCtrl); this.groupBoxLiquidStream.Controls.Add(ctrl); ctrl.Location = new Point(276, 12 + 20 + 2); this.textBoxLiquidOutName.SetSolvable(wetScrubber.LiquidOutlet); this.groupBoxLiquidStream.Controls.Add(this.textBoxLiquidOutName); this.textBoxLiquidOutName.Text = wetScrubber.LiquidOutlet.Name; UI.SetStatusColor(this.textBoxLiquidOutName, wetScrubber.LiquidOutlet.SolveState); } }