コード例 #1
0
        public void Init()
        {
            loaded = false;

            Pages.Clear();

            // connections

            if (obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.EnergyStream &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.OT_Adjust &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.Controller_PID &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.LevelGauge &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.AnalogGauge &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.DigitalGauge &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.Input &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.Switch &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.OT_Spec)
            {
                var tab1 = new DocumentPage {
                    Closable = false
                };
                tab1.Text = "Connections";

                var cont0 = UI.Shared.Common.GetDefaultContainer();

                UI.Shared.Common.CreateAndAddLabelRow(cont0, "Object Connections Editor".Localize());

                UI.Shared.Common.CreateAndAddDescriptionRow(cont0, "ConnectorsEditorDescription".Localize());
                new DWSIM.UI.Desktop.Editors.ConnectionsEditor(obj, cont0);

                cont0.Width = this.Width - 30;

                var scr1 = new Scrollable()
                {
                    Content = cont0
                };
                tab1.Content = scr1;

                Pages.Add(tab1);

                PageConnections = tab1;
            }

            // properties

            var tab2 = new DocumentPage {
                Closable = false
            };

            tab2.Text = "Properties";

            Pages.Add(tab2);

            var cont = UI.Shared.Common.GetDefaultContainer();

            cont.Width = this.Width - 30;

            if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream)
            {
                new DWSIM.UI.Desktop.Editors.MaterialStreamEditor(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.DistillationColumn)
            {
                new DWSIM.UI.Desktop.Editors.DistillationColumnEditor(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.AbsorptionColumn)
            {
                new DWSIM.UI.Desktop.Editors.AbsorptionColumnEditor(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Adjust)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.AdjustEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Controller_PID)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.PIDControllerEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Spec)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.SpecEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Recycle)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.RecycleEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_EnergyRecycle)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.EnergyRecycleEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.LevelGauge)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.LevelGaugeEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.AnalogGauge)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.AnalogGaugeEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.DigitalGauge)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.DigitalGaugeEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Switch)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.SwitchEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Input)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.InputEditor.Populate(obj, cont);
            }
            else
            {
                new DWSIM.UI.Desktop.Editors.GeneralEditors(obj, cont);
            }

            tab2.Content = new Scrollable()
            {
                Content = cont, Width = this.Width - 30
            };

            if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Pipe)
            {
                tab2.Text = "General";
                var cont2 = UI.Shared.Common.GetDefaultContainer();
                cont2.Tag   = "Hydraulic Profile";
                cont2.Width = this.Width - 30;
                new PipeHydraulicProfile(obj, cont2);
                Pages.Add(new DocumentPage(new Scrollable()
                {
                    Content = cont2, Width = this.Width - 30
                })
                {
                    Text = "Hydraulic Profile", Closable = false
                });
                var cont3 = UI.Shared.Common.GetDefaultContainer();
                cont3.Tag   = "Thermal Profile";
                cont3.Width = this.Width - 30;
                new PipeThermalProfile(obj, ((Pipe)obj).ThermalProfile, cont3);
                Pages.Add(new DocumentPage(new Scrollable()
                {
                    Content = cont3, Width = this.Width - 30
                })
                {
                    Text = "Thermal Profile", Closable = false
                });
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.CustomUO)
            {
                tab2.Text = "General";
                var cont2 = new TableLayout {
                    Padding = new Padding(10), Spacing = new Size(5, 5)
                };
                cont2.Tag   = "Python Script";
                cont2.Width = this.Width - 30;
                if (Application.Instance.Platform.IsWpf)
                {
                    var scripteditor = new Eto.Forms.Controls.Scintilla.Shared.ScintillaControl()
                    {
                        ScriptText = ((CustomUO)obj).ScriptText
                    };
                    var dyn1 = new DynamicLayout();
                    dyn1.CreateAndAddLabelAndButtonRow("Click to commit script changes", "Update", null, (sender, e) =>
                    {
                        ((CustomUO)obj).ScriptText = scripteditor.ScriptText;
                    });
                    dyn1.Width = this.Width - 30;
                    cont2.Rows.Add(new TableRow(dyn1));
                    cont2.Rows.Add(new TableRow(scripteditor));
                }
                else if (Application.Instance.Platform.IsMac || Application.Instance.Platform.IsGtk)
                {
                    var scripteditor = new Eto.Forms.Controls.Scintilla.Shared.ScintillaControl()
                    {
                        ScriptText = ((CustomUO)obj).ScriptText
                    };
                    scripteditor.SetKeywords(1, ((FlowsheetBase.FlowsheetBase)obj.GetFlowsheet()).ScriptKeywordsU);
                    var dyn1 = new DynamicLayout();
                    dyn1.CreateAndAddLabelAndButtonRow("Click to commit script changes", "Update", null, (sender, e) =>
                    {
                        ((CustomUO)obj).ScriptText = scripteditor.ScriptText;
                    });
                    dyn1.Width = this.Width - 30;
                    cont2.Rows.Add(new TableRow(dyn1));
                    cont2.Rows.Add(new TableRow(scripteditor));
                }
                Pages.Add(new DocumentPage(new Scrollable()
                {
                    Content = cont2, Width = this.Width - 30
                })
                {
                    Text = "Python Script", Closable = false
                });
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.HeatExchanger)
            {
                tab2.Text = "General";
                var dyn1 = new ShellAndTubePropertiesView(obj);
                dyn1.Width = this.Width - 30;
                Pages.Add(new DocumentPage(new Scrollable()
                {
                    Content = dyn1, Width = this.Width - 30
                })
                {
                    Text = "Shell and Tube Properties", Closable = false
                });
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.AbsorptionColumn ||
                     obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.DistillationColumn)
            {
                tab2.Text = "General";
                var dyn2 = RigorousColumnShared.GetInitialEstimatesEditor((Column)obj);
                dyn2.Width = this.Width - 30;
                Pages.Add(new DocumentPage(new Scrollable()
                {
                    Content = dyn2, Width = this.Width - 30
                })
                {
                    Text = "Initial Estimates", Closable = false
                });
            }

            PageEditor = tab2;

            // dynamics

            if ((obj.SupportsDynamicMode && obj.HasPropertiesForDynamicMode) || obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream)
            {
                if (obj.ExtraPropertiesDescriptions.Count() > 0 || obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream)
                {
                    var tabd = new DocumentPage {
                        Closable = false
                    };
                    tabd.Text = "Dynamics";

                    var contd = UI.Shared.Common.GetDefaultContainer();

                    contd.Width = this.Width - 30;

                    new DynamicPropertiesEditor(obj, contd);

                    tabd.Content = new Scrollable()
                    {
                        Content = contd, Width = this.Width - 30
                    };

                    PageDynamics = tabd;

                    Pages.Add(tabd);
                }
            }

            // results

            var tabr = new DocumentPage {
                Closable = false
            };

            tabr.Text = "Results";

            var container = new TableLayout();

            new DWSIM.UI.Desktop.Editors.Results(obj, container);

            tabr.Content = new Scrollable()
            {
                Content = container, Width = this.Width - 30
            };

            PageResults = tabr;

            Pages.Add(tabr);

            if (obj.GraphicObject is ShapeGraphic)
            {
                var tabx = new DocumentPage {
                    Closable = false
                };
                tabx.Text = "Appearance";
                var editor = new ObjectAppearanceEditorView(obj.GetFlowsheet(), (ShapeGraphic)obj.GraphicObject);
                editor.Width = this.Width - 30;
                tabx.Content = new Scrollable()
                {
                    Content = editor, Width = this.Width - 30
                };

                Pages.Add(tabx);
            }

            if (SelectedPanel >= 0)
            {
                SelectedIndex = SelectedPanel;
            }

            loaded = true;
        }
コード例 #2
0
        public void Init()
        {
            loaded = false;

            Pages.Clear();

            // connections

            if (obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.EnergyStream &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.OT_Adjust &&
                obj.GraphicObject.ObjectType != Interfaces.Enums.GraphicObjects.ObjectType.OT_Spec)
            {
                var tab1 = new TabPage();
                tab1.Text = "Connections";

                var cont0 = UI.Shared.Common.GetDefaultContainer();

                UI.Shared.Common.CreateAndAddDescriptionRow(cont0, "ConnectorsEditorDescription".Localize());
                new DWSIM.UI.Desktop.Editors.ConnectionsEditor(obj, cont0);

                cont0.Width = this.Width - 30;

                var scr1 = new Scrollable()
                {
                    Content = cont0
                };
                tab1.Content = scr1;

                Pages.Add(tab1);
            }

            // properties

            var tab2 = new TabPage();

            tab2.Text = "Properties";

            Pages.Add(tab2);

            var cont = UI.Shared.Common.GetDefaultContainer();

            cont.Width = this.Width - 30;

            if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.MaterialStream)
            {
                new DWSIM.UI.Desktop.Editors.MaterialStreamEditor(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.DistillationColumn)
            {
                new DWSIM.UI.Desktop.Editors.DistillationColumnEditor(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.AbsorptionColumn)
            {
                new DWSIM.UI.Desktop.Editors.AbsorptionColumnEditor(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Adjust)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.AdjustEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Spec)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.SpecEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_Recycle)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.RecycleEditor.Populate(obj, cont);
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.OT_EnergyRecycle)
            {
                DWSIM.UI.Desktop.Editors.LogicalBlocks.EnergyRecycleEditor.Populate(obj, cont);
            }
            else
            {
                new DWSIM.UI.Desktop.Editors.GeneralEditors(obj, cont);
            }

            tab2.Content = new Scrollable()
            {
                Content = cont, Width = this.Width - 30
            };

            if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.Pipe)
            {
                tab2.Text = "General";
                var cont2 = UI.Shared.Common.GetDefaultContainer();
                cont2.Tag   = "Hydraulic Profile";
                cont2.Width = this.Width - 30;
                new PipeHydraulicProfile(obj, cont2);
                Pages.Add(new TabPage(new Scrollable()
                {
                    Content = cont2, Width = this.Width - 30
                })
                {
                    Text = "Hydraulic Profile"
                });
                var cont3 = UI.Shared.Common.GetDefaultContainer();
                cont3.Tag   = "Thermal Profile";
                cont3.Width = this.Width - 30;
                new PipeThermalProfile(obj, cont3);
                Pages.Add(new TabPage(new Scrollable()
                {
                    Content = cont3, Width = this.Width - 30
                })
                {
                    Text = "Thermal Profile"
                });
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.CustomUO)
            {
                tab2.Text = "General";
                var cont2 = new TableLayout {
                    Padding = new Padding(10), Spacing = new Size(5, 5)
                };
                cont2.Tag   = "Python Script";
                cont2.Width = this.Width - 30;
                var scripteditor = new DWSIM.UI.Controls.CodeEditorControl()
                {
                    Text = ((CustomUO)obj).ScriptText
                };
                var dyn1 = new DynamicLayout();
                dyn1.CreateAndAddLabelAndButtonRow("Click to commit script changes", "Update", null, (sender, e) =>
                {
                    ((CustomUO)obj).ScriptText = scripteditor.Text;
                });
                dyn1.Width = this.Width - 30;
                cont2.Rows.Add(new TableRow(dyn1));
                cont2.Rows.Add(new TableRow(scripteditor));
                Pages.Add(new TabPage(new Scrollable()
                {
                    Content = cont2, Width = this.Width - 30
                })
                {
                    Text = "Python Script"
                });
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.HeatExchanger)
            {
                tab2.Text = "General";
                var dyn1 = new UI.Desktop.Editors.ShellAndTubePropertiesView(obj);
                dyn1.Width = this.Width - 30;
                Pages.Add(new TabPage(new Scrollable()
                {
                    Content = dyn1, Width = this.Width - 30
                })
                {
                    Text = "Shell and Tube Properties"
                });
            }
            else if (obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.AbsorptionColumn ||
                     obj.GraphicObject.ObjectType == Interfaces.Enums.GraphicObjects.ObjectType.DistillationColumn)
            {
                tab2.Text = "General";
                var dyn2 = UI.Desktop.Editors.RigorousColumnShared.GetInitialEstimatesEditor((Column)obj);
                dyn2.Width = this.Width - 30;
                Pages.Add(new TabPage(new Scrollable()
                {
                    Content = dyn2, Width = this.Width - 30
                })
                {
                    Text = "Initial Estimates"
                });
            }

            PageEditor = tab2;

            var tabr = new TabPage();

            tabr.Text = "Results";

            var container = new TableLayout();

            new DWSIM.UI.Desktop.Editors.Results(obj, container);

            tabr.Content = new Scrollable()
            {
                Content = container, Width = this.Width - 30
            };

            PageResults = tabr;

            Pages.Add(tabr);

            if (obj.GraphicObject is ShapeGraphic)
            {
                var tabx = new TabPage();
                tabx.Text = "Appearance";
                var editor = new ObjectAppearanceEditorView(obj.GetFlowsheet(), (ShapeGraphic)obj.GraphicObject);
                editor.Width = this.Width - 30;
                tabx.Content = new Scrollable()
                {
                    Content = editor, Width = this.Width - 30
                };

                Pages.Add(tabx);
            }

            if (SelectedPanel >= 0)
            {
                SelectedIndex = SelectedPanel;
            }

            loaded = true;
        }