Ejemplo n.º 1
0
        private void InitializeUnitOpList()
        {
            this.updateFlag = false;
            IList       list = this.flowsheet.UnitOpManager.GetUnitOpControls();
            IEnumerator e    = list.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableControl ctrl = (SolvableControl)e.Current;
                if (!(ctrl is RecycleControl))
                {
                    string s = ctrl.Solvable.Name;
                    this.checkedListBoxUnitOps.Items.Add(s);
                    int i = this.checkedListBoxUnitOps.Items.IndexOf(s);
                    this.checkedListBoxUnitOps.SetItemChecked(i, ctrl.IsShownInEditor);
                }
            }
            this.updateFlag = true;
        }
Ejemplo n.º 2
0
        private void Find()
        {
            string findStr = this.textBoxFindWhat.Text.Trim();

            if (findStr.Length > 0)
            {
                this.flowsheet.SetSolvableControlsSelection(false);
                this.flowsheet.ResetActivity();
                ArrayList solvables = null;

                if (this.radioButtonAll.Checked)
                {
                    solvables = this.flowsheet.EvaporationAndDryingSystem.GetSolvableList();
                }
                else if (this.radioButtonStreams.Checked)
                {
                    solvables = this.flowsheet.EvaporationAndDryingSystem.GetStreamList();
                }
                else if (this.radioButtonUnitOps.Checked)
                {
                    solvables = this.flowsheet.EvaporationAndDryingSystem.GetUnitOpList();
                }

                IEnumerator en = solvables.GetEnumerator();
                while (en.MoveNext())
                {
                    Solvable sol  = en.Current as Solvable;
                    string   name = sol.Name;
                    if (UI.StringContainsString(name, findStr, !this.checkBoxMatchCase.Checked))
                    {
                        SolvableControl ctrl = this.flowsheet.StreamManager.GetProcessStreamBaseControl(name);
                        if (ctrl == null)
                        {
                            ctrl = this.flowsheet.UnitOpManager.GetUnitOpControl(name);
                        }
                        ctrl.IsSelected = true;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void InitializeVarValuesControl(SolvableControl sovableCtrl)
        {
            ArrayList         varList = sovableCtrl.Solvable.VarList;
            ProcessVarTextBox varTextBox;

            varTextBoxeList = new ArrayList();
            this.SuspendLayout();
            for (int i = 0; i < varList.Count; i++)
            {
                varTextBox = new ProcessVarTextBox();
                varTextBoxeList.Add(varTextBox);
                varTextBox.Location  = new System.Drawing.Point(0, i * 20);
                varTextBox.Size      = new System.Drawing.Size(80, 20);
                varTextBox.TabIndex  = 110 + i;
                varTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
                varTextBox.KeyUp    += new System.Windows.Forms.KeyEventHandler(this.KeyUpHandler);
                this.Controls.Add(varTextBox);
                varTextBox.InitializeVariable(sovableCtrl.Flowsheet.ApplicationPrefs, ((ProcessVar)varList[i]));
            }

            this.Size = new System.Drawing.Size(80, varTextBoxeList.Count * 20);
            this.ResumeLayout(false);
            this.PerformLayout();
        }
Ejemplo n.º 4
0
        public SolvableEditor(SolvableControl solvableCtrl)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.solvableCtrl = solvableCtrl;

            this.labelName.BackColor = Color.DarkGray;
            if (solvableCtrl.Solvable != null)
            {
                this.textBoxName.Text = solvableCtrl.Solvable.Name;
            }
            else
            {
                this.textBoxName.Text = "";
            }

            this.Solvable_SolveComplete(this.solvableCtrl.Solvable, this.solvableCtrl.Solvable.SolveState);

            this.solvableCtrl.Solvable.SolveComplete += new SolveCompleteEventHandler(Solvable_SolveComplete);
            this.solvableCtrl.Solvable.NameChanged   += new NameChangedEventHandler(Solvable_NameChanged);
        }
Ejemplo n.º 5
0
 private void var_NameChanged(object sender, string name, string oldName)
 {
     this.Text = SolvableControl.GetVariableName(this.var, UnitSystemService.GetInstance().CurrentUnitSystem);
 }
Ejemplo n.º 6
0
 private void ProcessVarLabel_CurrentUnitSystemChanged(UnitSystem unitSystem)
 {
     this.Text = SolvableControl.GetVariableName(this.var, unitSystem);
 }
Ejemplo n.º 7
0
 public void ResetActivity()
 {
     SetFlowsheetActivity(FlowsheetActivity.Default);
     this.firstStepCtrl = null;
     this.attachIndex   = -1;
 }
Ejemplo n.º 8
0
 public void AddConnection()
 {
     SetFlowsheetActivity(FlowsheetActivity.AddingConnStepOne);
     this.firstStepCtrl = null;
     this.attachIndex   = -1;
 }
Ejemplo n.º 9
0
 public ProcessVarValuesControl(SolvableControl solvableCtrl)
 {
     InitializeVarValuesControl(solvableCtrl);
 }
Ejemplo n.º 10
0
        protected int initializeGrid(SolvableControl ctrl, int columnIndex, Boolean bValueOnly, string ctrlType)
        {
            ProcessVar        var;
            ProcessVarLabel   label;
            ProcessVarTextBox valueTextBox;
            ArrayList         varList;
            Label             typeLabel, nameLabel;
            int counter, extraRowCount;

            varList = ctrl.Solvable.VarList;
            if (ctrlType.Length != 0)
            {
                typeLabel           = new Label();
                typeLabel.Size      = new System.Drawing.Size(192, 20);
                typeLabel.Dock      = DockStyle.Fill;
                typeLabel.Anchor    = AnchorStyles.Left;
                typeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                typeLabel.Text      = ctrlType;
                typeLabel.BackColor = Color.DarkGray;

                nameLabel           = new Label();
                nameLabel.Size      = new System.Drawing.Size(80, 20);
                nameLabel.Dock      = DockStyle.Fill;
                nameLabel.Anchor    = AnchorStyles.Left;
                nameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                nameLabel.Text      = ctrl.Solvable.ToString();
                nameLabel.BackColor = Color.DarkGray;
                if (bValueOnly)
                {
                    this.tableLayoutPanel.ColumnCount = columnIndex + 1;
                    this.tableLayoutPanel.Controls.Add(nameLabel, columnIndex, 0);
                }
                else
                {
                    this.tableLayoutPanel.ColumnCount = columnIndex + 2;
                    this.tableLayoutPanel.Controls.Add(typeLabel, columnIndex, 0);
                    this.tableLayoutPanel.Controls.Add(nameLabel, columnIndex + 1, 0);
                }
                extraRowCount = 1;
            }
            else
            {
                extraRowCount = 0;
            }
            // set the property names and values
            for (counter = 0; counter < varList.Count; counter++)
            {
                var = varList[counter] as ProcessVar;
                if (var == null)
                {
                    continue;
                }

                valueTextBox      = new ProcessVarTextBox();
                valueTextBox.Size = new System.Drawing.Size(80, 20);

                valueTextBox.Dock   = DockStyle.Fill;
                valueTextBox.Anchor = AnchorStyles.Left & AnchorStyles.Right & AnchorStyles.Top & AnchorStyles.Bottom;
                valueTextBox.InitializeVariable(solvableCtrl.Flowsheet.ApplicationPrefs, var);

                if (bValueOnly)
                {
                    this.tableLayoutPanel.Controls.Add(valueTextBox, columnIndex, counter + extraRowCount);
                }
                else
                {
                    label          = new ProcessVarLabel();
                    label.Anchor   = System.Windows.Forms.AnchorStyles.Left;
                    label.Size     = new System.Drawing.Size(192, 20);
                    label.AutoSize = false;
                    //label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                    label.Dock = DockStyle.Fill;
                    label.Text = var.VarTypeName;
                    label.InitializeVariable(var);

                    this.tableLayoutPanel.Controls.Add(label, columnIndex, counter + extraRowCount);
                    this.tableLayoutPanel.Controls.Add(valueTextBox, columnIndex + 1, counter + extraRowCount);
                }
                this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 24F));
            }
            if (this.tableLayoutPanel.RowCount < counter + extraRowCount)
            {
                this.tableLayoutPanel.RowCount = counter + extraRowCount;
            }
            return(counter + extraRowCount);
        }