Ejemplo n.º 1
0
        protected override void ValidatingHandler(object sender, System.ComponentModel.CancelEventArgs e)
        {
            TwoStreamUnitOperation twoStreamUnitOp = this.TwoStreamUnitOpCtrl.TwoStreamUnitOp;
            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 = twoStreamUnitOp.SpecifyName(this.textBoxName.Text);
                        if (error != null)
                        {
                            UI.ShowError(error);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public TwoStreamUnitOpControl(Flowsheet flowsheet, Point location, TwoStreamUnitOperation twoStrUnitOp)
     :
     base(flowsheet, location, twoStrUnitOp)
 {
     // This call is required by the Windows.Forms Form Designer.
     InitializeComponent();
 }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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;

            if (streamIn != null)
            {
                hasStreamIn = true;
            }

            ProcessStreamBase streamOut = twoStreamUnitOp.Outlet;

            if (streamOut != null)
            {
                hasStreamOut = true;
            }

            if (hasStreamIn)
            {
                ProcessStreamBaseControl processInCtrl = (ProcessStreamBaseControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Inlet.Name);
                initializeGrid(processInCtrl, columnIndex, false, "Inlet/Outlet");
                columnIndex += 2;
            }
            if (hasStreamOut)
            {
                ProcessStreamBaseControl processOutCtrl = (ProcessStreamBaseControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Outlet.Name);
                if (hasStreamIn)
                {
                    initializeGrid(processOutCtrl, columnIndex, true, "Inlet/Outlet");
                    columnIndex++;
                }
                else
                {
                    initializeGrid(processOutCtrl, columnIndex, false, "Inlet/Outlet");
                    columnIndex += 2;
                }
            }
            //if (hasStreamIn || hasStreamOut)
            //{
            //   ProcessStreamBase labelsStream = null;
            //   if (hasStreamIn)
            //      labelsStream = streamIn;
            //   else if (hasStreamOut)
            //      labelsStream = streamOut;

            //   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.groupBoxStreams.Controls.Add(ctrl);
            //   ctrl.Location = new Point(4, 12 + 20 + 2);
            //}

            //if (hasStreamIn)
            //{
            //   UserControl ctrl = null;
            //   if (streamIn is ProcessStream)
            //   {
            //      ProcessStreamControl processInCtrl = (ProcessStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Inlet.Name);
            //      ctrl = new ProcessStreamValuesControl(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);
            //   }
            //   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)
            //{
            //   UserControl ctrl = null;
            //   if (streamOut is ProcessStream)
            //   {
            //      ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Outlet.Name);
            //      ctrl = new ProcessStreamValuesControl(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);
            //   }
            //   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);
            //}
        }