Esempio n. 1
0
        void AddPropPackItem(PropertyPackage pp)
        {
            pp.Flowsheet = flowsheet;
            var tr = new TableRow();

            tr = s.CreateAndAddTextBoxAndTwoButtonsRow(ppcontainer, pp.Tag, "Edit", null, "Remove", null,
                                                       (arg1, arg2) =>
            {
                pp.Tag = arg1.Text;
            },
                                                       (arg1, arg2) =>
            {
                var supported = new string[] { "NRTL", "UNIQUAC", "Peng-Robinson (PR)", "Soave-Redlich-Kwong (SRK)", "Lee-Kesler-Plöcker" };
                if (supported.Contains(pp.ComponentName))
                {
                    var cont = new PropertyPackageSettingsView(flowsheet, pp);
                    var form = s.GetDefaultEditorForm("Edit '" + pp.Tag + "' (" + pp.ComponentName + ")", 800, 500, cont);
                    form.Show();
                }
                else
                {
                    Application.Instance.Invoke(() => { pp.DisplayEditingForm(); });
                }
            },
                                                       (arg1, arg2) =>
            {
                if (MessageBox.Show("Confirm removal?", "Remove Property Package", MessageBoxButtons.YesNo, MessageBoxType.Question, MessageBoxDefaultButton.No) == DialogResult.Yes)
                {
                    ppcontainer.Remove(tr);
                    flowsheet.PropertyPackages.Remove(pp.UniqueID);
                }
            });
        }
Esempio n. 2
0
        void AddPropPackItem(PropertyPackage pp)
        {
            pp.Flowsheet = flowsheet;
            var tr = new TableRow();

            tr = s.CreateAndAddTextBoxAndTwoButtonsRow(ppcontainer, pp.Tag, "Edit", null, "Remove", null,
                                                       (arg1, arg2) =>
            {
                pp.Tag = arg1.Text;
            },
                                                       (arg1, arg2) =>
            {
                var supported = new string[] { "NRTL", "UNIQUAC", "Peng-Robinson (PR)", "Soave-Redlich-Kwong (SRK)", "Lee-Kesler-Plöcker" };
                if (supported.Contains(pp.ComponentName))
                {
                    var cont    = new PropertyPackageSettingsView(flowsheet, pp);
                    var cont2   = new PropertyPackageIPView(flowsheet, pp);
                    var cont3   = new FlashSettingsEditor(flowsheet, pp);
                    cont.Tag    = "General Settings";
                    cont2.Tag   = "Interaction Parameters";
                    cont3.Tag   = "Equilibrium Calculation Settings";
                    var advcont = pp.GetAdvancedEditingContainers();
                    var form    = s.GetDefaultTabbedForm("Edit '" + pp.Tag + "' (" + pp.ComponentName + ")", 800, 500, new DynamicLayout[] { cont2, cont3, cont, advcont[0], advcont[1] });
                    form.Show();
                }
                else
                {
                    //Application.Instance.Invoke(() => { pp.DisplayEditingForm(); });
                }
            },
                                                       (arg1, arg2) =>
            {
                if (MessageBox.Show("Confirm removal?", "Remove Property Package", MessageBoxButtons.YesNo, MessageBoxType.Question, MessageBoxDefaultButton.No) == DialogResult.Yes)
                {
                    ppcontainer.Remove(tr);
                    flowsheet.PropertyPackages.Remove(pp.UniqueID);
                    flowsheet.UpdateEditorPanels.Invoke();
                }
            });
        }