コード例 #1
0
        private void DisplayPage3()
        {
            SetupPropertyPackage();
            SetupFlashAlgorithm();

            var page = new WizardPage();

            page.hasBackButton   = true;
            page.hasCancelButton = true;
            page.hasNextButton   = false;
            page.hasFinishButton = true;

            page.cancelAction = () => { page.Close(); };
            page.finishAction = () => { page.Close(); };
            page.backAction   = () => { page.Close(); DisplayPage2(); };

            page.Title             = "Simulation Setup Wizard";
            page.HeaderTitle       = "Step 3 - Other Settings";
            page.HeaderDescription = "Configure miscellaneous simulation settings.";
            page.FooterText        = "Click 'Finish' to close this window and start building your process model.";

            page.Init(Width, Height);

            var dl = c.GetDefaultContainer();

            dl.Height = Height;
            dl.Width  = Width;

            c.CreateAndAddLabelRow(dl, "General");

            c.CreateAndAddStringEditorRow(dl, "Simulation Name", flowsheet.FlowsheetOptions.SimulationName, (sender, e) => flowsheet.FlowsheetOptions.SimulationName = sender.Text);

            c.CreateAndAddLabelRow2(dl, "The simulation name will be used for report identification and file name during saving.");

            var avunits = flowsheet.AvailableSystemsOfUnits.Select((x) => x.Name).ToList();

            c.CreateAndAddLabelRow(dl, "System of Units");
            c.CreateAndAddLabelRow2(dl, "Select the System of Units to be used on this simulation.");

            c.CreateAndAddDropDownRow(dl, "System of Units", avunits, avunits.IndexOf(flowsheet.FlowsheetOptions.SelectedUnitSystem.Name), (sender, e) =>
            {
                flowsheet.FlowsheetOptions.SelectedUnitSystem = flowsheet.AvailableSystemsOfUnits.Where((x) => x.Name == avunits[sender.SelectedIndex]).FirstOrDefault();
            });

            var nformats = new[] { "F", "G", "G2", "G4", "G6", "G8", "G10", "N", "N2", "N4", "N6", "R", "E", "E1", "E2", "E3", "E4", "E6" };

            c.CreateAndAddLabelRow(dl, "Number Formats");

            c.CreateAndAddDropDownRow(dl, "General", nformats.ToList(), nformats.ToList().IndexOf(flowsheet.FlowsheetOptions.NumberFormat), (sender, e) =>
            {
                flowsheet.FlowsheetOptions.NumberFormat = sender.SelectedValue.ToString();
            });

            c.CreateAndAddDescriptionRow(dl, "Select the formatting scheme for general numbers.");

            c.CreateAndAddDropDownRow(dl, "Compound Amounts", nformats.ToList(), nformats.ToList().IndexOf(flowsheet.FlowsheetOptions.FractionNumberFormat), (sender, e) =>
            {
                flowsheet.FlowsheetOptions.FractionNumberFormat = sender.SelectedValue.ToString();
            });

            c.CreateAndAddDescriptionRow(dl, "Select the formatting scheme for compound amounts in Material Stream reports.");

            page.ContentContainer.Add(dl);
            page.Show();
        }
コード例 #2
0
        private void DisplayPage2()
        {
            var page = new WizardPage();

            page.hasBackButton   = true;
            page.hasCancelButton = true;
            page.hasNextButton   = true;
            page.hasFinishButton = false;

            page.cancelAction = () => { page.Close(); };
            page.backAction   = () => { page.Close(); DisplayPage1(); };
            page.nextAction   = () => { page.Close(); DisplayPage3(); };

            page.Title             = "Simulation Setup Wizard";
            page.HeaderTitle       = "Step 2 - Process Model details";
            page.HeaderDescription = "Configure process model details.";
            page.FooterText        = "Click 'Next' to continue.";

            page.Init(Width, Height);

            var dl = c.GetDefaultContainer();

            dl.CreateAndAddLabelRow("Process Details");
            dl.CreateAndAddLabelRow2("Select an item according to your process charateristics and DWSIM will choose the best thermodynamic model setup for your simulation.");
            dl.CreateAndAddLabelRow2("If you prefer to add multiple Property Packages, close this wizard and go to 'Setup' > 'Basis'.");

            dl.CreateAndAddLabelRow("General Information");

            var rl = new RadioButtonList {
                Orientation = Orientation.Vertical
            };

            rl.Spacing = new Size(5, 5);

            rl.Items.Add("My process can be modeled using the Ideal Gas law for vapor phase and Ideal Solution Theory for liquid phase");
            rl.Items.Add("My process deals with hydrocarbons only");
            rl.Items.Add("My process has hydrocarbons and Water at higher pressures");
            rl.Items.Add("My process has polar chemicals");
            rl.Items.Add("My process deals with a refrigeration cycle");
            rl.Items.Add("This is a single Water/Steam simulation");
            rl.Items.Add("I'm simulating a process which involves aqueous electrolytes");
            rl.Items.Add("I want to select/use a specific Property Package");

            rl.SelectedIndexChanged += (s, e) => {
                switch (rl.SelectedIndex)
                {
                case 0:
                    hasLowPressure         = true;
                    hasHC                  = false;
                    hasHCW                 = false;
                    hasPolarChemicals      = false;
                    hasRefrigeration       = false;
                    hasSingleCompoundWater = false;
                    hasElectrolytes        = false;
                    ddpp.Enabled           = false;
                    break;

                case 1:
                    hasLowPressure         = false;
                    hasHC                  = true;
                    hasHCW                 = false;
                    hasPolarChemicals      = false;
                    hasRefrigeration       = false;
                    hasSingleCompoundWater = false;
                    hasElectrolytes        = false;
                    ddpp.Enabled           = false;
                    break;

                case 2:
                    hasLowPressure         = false;
                    hasHC                  = false;
                    hasHCW                 = true;
                    hasPolarChemicals      = false;
                    hasRefrigeration       = false;
                    hasSingleCompoundWater = false;
                    hasElectrolytes        = false;
                    ddpp.Enabled           = false;
                    break;

                case 3:
                    hasLowPressure         = false;
                    hasHC                  = false;
                    hasHCW                 = false;
                    hasPolarChemicals      = true;
                    hasRefrigeration       = false;
                    hasSingleCompoundWater = false;
                    hasElectrolytes        = false;
                    ddpp.Enabled           = false;
                    break;

                case 4:
                    hasLowPressure         = false;
                    hasHC                  = false;
                    hasHCW                 = false;
                    hasPolarChemicals      = false;
                    hasRefrigeration       = true;
                    hasSingleCompoundWater = false;
                    hasElectrolytes        = false;
                    ddpp.Enabled           = false;
                    break;

                case 5:
                    hasLowPressure         = false;
                    hasHC                  = false;
                    hasHCW                 = false;
                    hasPolarChemicals      = false;
                    hasRefrigeration       = false;
                    hasSingleCompoundWater = true;
                    hasElectrolytes        = false;
                    ddpp.Enabled           = false;
                    break;

                case 6:
                    hasLowPressure         = false;
                    hasHC                  = false;
                    hasHCW                 = false;
                    hasPolarChemicals      = false;
                    hasRefrigeration       = false;
                    hasSingleCompoundWater = false;
                    hasElectrolytes        = true;
                    ddpp.Enabled           = false;
                    break;

                case 7:
                    hasLowPressure         = false;
                    hasHC                  = false;
                    hasHCW                 = false;
                    hasPolarChemicals      = false;
                    hasRefrigeration       = false;
                    hasSingleCompoundWater = false;
                    hasElectrolytes        = false;
                    ddpp.Enabled           = true;
                    break;
                }
            };

            dl.CreateAndAddControlRow(rl);

            ddpp         = dl.CreateAndAddDropDownRow("Property Package", flowsheet.AvailablePropertyPackages.Keys.ToList(), 0, (dd, e) => { });
            ddpp.Enabled = false;

            if (!Application.Instance.Platform.IsGtk)
            {
                ddpp.Width = 350;
            }

            if (Application.Instance.Platform.IsGtk)
            {
                page.ContentContainer.Add(new Scrollable {
                    Content = dl, Border = BorderType.None, Height = Height, Width = Width
                });
            }
            else
            {
                dl.Height = Height;
                dl.Width  = Width;
                page.ContentContainer.Add(dl);
            }
            page.Show();
        }