void Init() { string imgprefix = "DWSIM.UI.Desktop.Editors.Resources.Icons."; Icon = Eto.Drawing.Icon.FromResource(imgprefix + "DWSIM_ico.ico"); Maximizable = false; Minimizable = false; WindowStyle = Eto.Forms.WindowStyle.Default; Title = "Error"; var mystring = SharedClasses.EncryptString.StringCipher.Decrypt("U4wpVD+ZjOp7lqhS02yctoZHpl/2sWfENp4lFnCXeyV8odS0qKsLpwUc1FXRaFO4fnLyS7+D12LMSV92VbsyuEvMBeHpbWhw/Ophn6zkI7Q6MIUkxIyyjgN9190xeArp/cEzSeSVyGPEbEq6MG5uqCCowGfyNxQP2Mm1d9GJkEQ=", "dwsim000000"); try { string baseaddress = "https://github.com/DanWBR/dwsim6/blob/windows/"; StackTrace st = new StackTrace(exc, true); StackFrame frame = st.GetFrame(0); string path = frame.GetFileName().Replace(mystring, baseaddress); int line = frame.GetFileLineNumber(); if (path.Contains(baseaddress)) { githublink = path + "#L" + line; } } catch (Exception) { } var container = new TableLayout() { Padding = new Padding(10), Spacing = new Size(5, 5) }; container.Rows.Add(new TableRow(new Label { Text = "DWSIM generated an unhandled error/exception." })); var txt1 = new TextArea { Text = exc.Message.ToString(), ReadOnly = true }; var txt2 = new TextArea { Text = exc.ToString(), ReadOnly = true }; var t1 = new TableLayout(new TableRow(txt1)); var t2 = new TableLayout(new TableRow(txt2)); var tab1 = new TabPage { Content = t1, Text = "Error Message" }; var tab2 = new TabPage { Content = t2, Text = "Details" }; var tabc = new TabControl { Height = 300 }; tabc.Pages.Add(tab1); tabc.Pages.Add(tab2); container.Rows.Add(new TableRow(tabc)); container.Rows.Add(new Label { Text = "Actions", Font = SystemFonts.Bold() }); var dyn1 = new DynamicLayout { Padding = new Padding(0) }; dyn1.CreateAndAddLabelAndButtonRow("Close this window.", "Continue", null, (sender, e) => { this.Close(); }); container.Rows.Add(new TableRow(dyn1)); var dyn2 = new DynamicLayout { Padding = new Padding(0) }; dyn2.CreateAndAddLabelAndButtonRow("Kill current DWSIM process. Unsaved changes will be lost.", "Kill", null, (sender, e) => { Process.GetCurrentProcess().Kill(); }); container.Rows.Add(new TableRow(dyn2)); var dyn3 = new DynamicLayout { Padding = new Padding(0) }; dyn3.CreateAndAddLabelAndButtonRow("Restart DWSIM", "Restart", null, (sender, e) => { Application.Instance.Restart(); }); container.Rows.Add(new TableRow(dyn3)); container.Rows.Add(new Label { Text = "Additional Support", Font = SystemFonts.Bold() }); var dyn4 = new DynamicLayout { Padding = new Padding(0) }; dyn4.CreateAndAddLabelAndButtonRow("Search DWSIM Forums for information about the current error.", "Search Forums", null, (sender, e) => { var baseaddress = "https://sourceforge.net/p/dwsim/search/?q="; var searchtext = exc.Message.ToString().Replace(" ", "+"); Process.Start(baseaddress + searchtext); }); container.Rows.Add(new TableRow(dyn4)); var dyn5 = new DynamicLayout { Padding = new Padding(0) }; dyn5.CreateAndAddLabelAndButtonRow("Search DWSIM's Website for information about the current error.", "Search Website", null, (sender, e) => { var baseaddress = "https://dwsim.org/wiki/index.php?title=Special:Search&fulltext=Search&profile=all&redirs=1&search="; var searchtext = exc.Message.ToString().Replace(" ", "+"); Process.Start(baseaddress + searchtext); }); container.Rows.Add(new TableRow(dyn5)); if (githublink != "") { var dyn6 = new DynamicLayout { Padding = new Padding(0) }; dyn6.CreateAndAddLabelAndButtonRow("View the code line where this error was raised/generated on DWSIM's GitHub repository.", "View code @ GitHub", null, (sender, e) => { Process.Start(githublink); }); container.Rows.Add(new TableRow(dyn6)); } Content = container; }
void Initialize() { rxcontainer = new DynamicLayout(); rscontainer = new DynamicLayout(); if (flowsheet.ReactionSets.Count == 0) { flowsheet.ReactionSets.Add("DefaultSet", new ReactionSet("DefaultSet", "Default Set", "")); } container.CreateAndAddLabelRow("Reactions"); CreateReactionsList(); container.CreateAndAddControlRow(rxcontainer); container.CreateAndAddLabelRow("Add a Reaction"); var btnAddConv = container.CreateAndAddLabelAndButtonRow("Add New Conversion Reaction", "New Conversion Reaction", null, (sender, e) => { var _rx = new Reaction("NewConvReac", Guid.NewGuid().ToString(), "") { ReactionType = Interfaces.Enums.ReactionType.Conversion }; var myview = s.GetDefaultContainer(); var cre = new ConversionReaction(flowsheet, _rx, myview); Form alert = null; myview.CreateAndAddTwoButtonsRow("Cancel", null, "Add", null, (sender2, e2) => alert.Close(), (sender2, e2) => { _rx = (Reaction)cre.rx; flowsheet.Reactions.Add(_rx.ID, _rx); flowsheet.ReactionSets["DefaultSet"].Reactions.Add(_rx.ID, new ReactionSetBase(_rx.ID, 0, true)); CreateReactionsList(); alert.Close(); }); alert = s.GetDefaultEditorForm("Add Conversion Reaction", 500, 400, myview); alert.Shown += (s1, e1) => { myview.Invalidate(); alert.Height = myview.Height + 40; }; alert.Topmost = true; alert.Show(); }); var btnAddEq = container.CreateAndAddLabelAndButtonRow("Add New Equilibrium Reaction", "New Equilibrium Reaction", null, (sender, e) => { var _rx = new Reaction("NewEqReac", Guid.NewGuid().ToString(), "") { ReactionType = Interfaces.Enums.ReactionType.Equilibrium }; var myview = s.GetDefaultContainer(); var cre = new EquilibriumReaction(flowsheet, _rx, myview); Form alert = null; myview.CreateAndAddTwoButtonsRow("Cancel", null, "Add", null, (sender2, e2) => alert.Close(), (sender2, e2) => { _rx = (Reaction)cre.rx; flowsheet.Reactions.Add(_rx.ID, _rx); flowsheet.ReactionSets["DefaultSet"].Reactions.Add(_rx.ID, new ReactionSetBase(_rx.ID, 0, true)); CreateReactionsList(); alert.Close(); }); alert = s.GetDefaultEditorForm("Add Equilibrium Reaction", 500, 400, myview); alert.Shown += (s1, e1) => { myview.Invalidate(); alert.Height = myview.Height + 40; }; alert.Topmost = true; alert.Show(); }); var btnAddKin = container.CreateAndAddLabelAndButtonRow("Add New Kinetic Reaction", "New Kinetic Reaction", null, (sender, e) => { var _rx = new Reaction("NewKinReac", Guid.NewGuid().ToString(), "") { ReactionType = Interfaces.Enums.ReactionType.Kinetic }; var myview = s.GetDefaultContainer(); var cre = new KineticReaction(flowsheet, _rx, myview); Form alert = null; myview.CreateAndAddTwoButtonsRow("Cancel", null, "Add", null, (sender2, e2) => alert.Close(), (sender2, e2) => { _rx = (Reaction)cre.rx; flowsheet.Reactions.Add(_rx.ID, _rx); flowsheet.ReactionSets["DefaultSet"].Reactions.Add(_rx.ID, new ReactionSetBase(_rx.ID, 0, true)); CreateReactionsList(); alert.Close(); }); alert = s.GetDefaultEditorForm("Add Kinetic Reaction", 850, 760, myview); alert.Shown += (s1, e1) => { myview.Invalidate(); alert.Height = myview.Height + 40; }; alert.Topmost = true; alert.Show(); }); var btnAddHC = container.CreateAndAddLabelAndButtonRow("Add New Heterogeneous Catalytic Reaction", "New HetCat Reaction", null, (sender, e) => { var _rx = new Reaction("NewHetCatReac", Guid.NewGuid().ToString(), "") { ReactionType = Interfaces.Enums.ReactionType.Heterogeneous_Catalytic }; var myview = s.GetDefaultContainer(); var cre = new HetCatReaction(flowsheet, _rx, myview); Form alert = null; myview.CreateAndAddTwoButtonsRow("Cancel", null, "Add", null, (sender2, e2) => alert.Close(), (sender2, e2) => { _rx = (Reaction)cre.rx; flowsheet.Reactions.Add(_rx.ID, _rx); flowsheet.ReactionSets["DefaultSet"].Reactions.Add(_rx.ID, new ReactionSetBase(_rx.ID, 0, true)); CreateReactionsList(); alert.Close(); }); alert = s.GetDefaultEditorForm("Add Heterogeneous Catalytic Reaction", 850, 690, myview); alert.Shown += (s1, e1) => { myview.Invalidate(); alert.Height = myview.Height + 40; }; alert.Topmost = true; alert.Show(); }); container.CreateAndAddEmptySpace(); container.CreateAndAddLabelRow("Reaction Sets"); container.CreateAndAddControlRow(rscontainer); container.CreateAndAddLabelRow("Add a Reaction Set"); container.CreateAndAddLabelAndButtonRow("Add New Reaction Set", "New Reaction Set", null, (sender, e) => { var rsid = Guid.NewGuid().ToString(); flowsheet.ReactionSets.Add(rsid, new ReactionSet(rsid, "NewReactionSet", "")); flowsheet.UpdateEditorPanels.Invoke(); CreateReactionSetsList(); }); CreateReactionSetsList(); }
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; }
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; }
void Init() { string imgprefix = "DWSIM.UI.Desktop.Editors.Resources.Icons."; Icon = Eto.Drawing.Icon.FromResource(imgprefix + "DWSIM_ico.ico"); Maximizable = false; Minimizable = false; WindowStyle = Eto.Forms.WindowStyle.Default; Title = "Error"; var mystring = SharedClasses.EncryptString.StringCipher.Decrypt("YEZeCozmw0l3XjOYI0EpOXHh1LK9as6Bi5Gwqr7pYZyXtcNYQyzayHXts6NjAJlpfixoim98NAwVHli/+h1fYk6g4W82ewXDxkLwzg5SFCCSS2W0K3TvGMgC0wQWuKfrut0QdnByVKZ4x+/svdQwwXsUkZdELOUtnWiOdeV6WIQ=", "dwsim000000"); var mystring2 = SharedClasses.EncryptString.StringCipher.Decrypt("T+h/AQaXoM7xMDrov6dkD/82uHShQ6gX7MD+yyPG1ALdchPnpYsxHZWU8YcwP3jTPCZWRL9mmAWnQnWtp4ETyYh17Cgjt1EDYbEJJvh/PacWXami/6btnnbE0D5HBpnYrKamsf6qjjx9JbhQOZIvXJv6dIlJ7lMm5vWkhmLpNuc=", "dwsim000000"); try { string baseaddress = "https://github.com/DanWBR/dwsim5/blob/master/"; StackTrace st = new StackTrace(exc, true); StackFrame frame = st.GetFrame(0); string path = frame.GetFileName().Replace(mystring, baseaddress); path = path.Replace(mystring2, baseaddress); int line = frame.GetFileLineNumber(); if (path.Contains(baseaddress)) { githublink = path + "#L" + line; } } catch (Exception) { } var container = new TableLayout() { Padding = new Padding(10), Spacing = new Size(5, 5) }; container.Rows.Add(new TableRow(new Label { Text = "DWSIM generated an unhandled error/exception." })); var txt1 = new TextArea { Text = exc.Message.ToString(), ReadOnly = true }; var txt2 = new TextArea { Text = exc.ToString(), ReadOnly = true }; var t1 = new TableLayout(new TableRow(txt1)); var t2 = new TableLayout(new TableRow(txt2)); var tab1 = new TabPage { Content = t1, Text = "Error Message" }; var tab2 = new TabPage { Content = t2, Text = "Details" }; var tabc = new TabControl { Height = 300 }; tabc.Pages.Add(tab1); tabc.Pages.Add(tab2); container.Rows.Add(new TableRow(tabc)); container.Rows.Add(new Label { Text = "Actions", Font = SystemFonts.Bold() }); var dyn1 = new DynamicLayout { Padding = new Padding(0) }; dyn1.CreateAndAddLabelAndButtonRow("Close this window.", "Continue", null, (sender, e) => { this.Close(); }); container.Rows.Add(new TableRow(dyn1)); var dyn2 = new DynamicLayout { Padding = new Padding(0) }; dyn2.CreateAndAddLabelAndButtonRow("Kill current DWSIM process. Unsaved changes will be lost.", "Kill", null, (sender, e) => { Process.GetCurrentProcess().Kill(); }); container.Rows.Add(new TableRow(dyn2)); var dyn3 = new DynamicLayout { Padding = new Padding(0) }; dyn3.CreateAndAddLabelAndButtonRow("Restart DWSIM", "Restart", null, (sender, e) => { Application.Instance.Restart(); }); container.Rows.Add(new TableRow(dyn3)); container.Rows.Add(new Label { Text = "Additional Support", Font = SystemFonts.Bold() }); var dyn4 = new DynamicLayout { Padding = new Padding(0) }; dyn4.CreateAndAddLabelAndButtonRow("Search DWSIM Forums for information about the current error.", "Search Forums", null, (sender, e) => { var baseaddress = "https://sourceforge.net/p/dwsim/search/?q="; var searchtext = exc.Message.ToString().Replace(" ", "+"); Process.Start(baseaddress + searchtext); }); container.Rows.Add(new TableRow(dyn4)); var dyn5 = new DynamicLayout { Padding = new Padding(0) }; dyn5.CreateAndAddLabelAndButtonRow("Search DWSIM's Website for information about the current error.", "Search Website", null, (sender, e) => { var baseaddress = "http://dwsim.inforside.com.br/wiki/index.php?title=Special:Search&fulltext=Search&profile=all&redirs=1&search="; var searchtext = exc.Message.ToString().Replace(" ", "+"); Process.Start(baseaddress + searchtext); }); container.Rows.Add(new TableRow(dyn5)); if (githublink != "") { var dyn6 = new DynamicLayout { Padding = new Padding(0) }; dyn6.CreateAndAddLabelAndButtonRow("View the code line where this error was raised/generated on DWSIM's GitHub repository.", "View code @ GitHub", null, (sender, e) => { Process.Start(githublink); }); container.Rows.Add(new TableRow(dyn6)); } Content = container; }