Skip to content
This repository has been archived by the owner on Jun 17, 2020. It is now read-only.

Commit

Permalink
[WIP] inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
DanWBR committed Apr 8, 2018
1 parent da5bd01 commit 0c0be9e
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 32 deletions.
6 changes: 6 additions & 0 deletions DWSIM.Inspector/DWSIM.Inspector.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
<HintPath>..\packages\HtmlAgilityPack.1.4.9.5\lib\Net45\HtmlAgilityPack.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SkiaSharp, Version=1.60.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\SkiaSharp.1.60.0\lib\net45\SkiaSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
Expand Down Expand Up @@ -98,6 +101,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="PerfAn.vb" />
<Compile Include="Window.vb" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -141,5 +145,7 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Eto.Forms.2.4.1\build\Eto.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Eto.Forms.2.4.1\build\Eto.Forms.targets'))" />
<Error Condition="!Exists('..\packages\SkiaSharp.1.60.0\build\net45\SkiaSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SkiaSharp.1.60.0\build\net45\SkiaSharp.targets'))" />
</Target>
<Import Project="..\packages\SkiaSharp.1.60.0\build\net45\SkiaSharp.targets" Condition="Exists('..\packages\SkiaSharp.1.60.0\build\net45\SkiaSharp.targets')" />
</Project>
56 changes: 56 additions & 0 deletions DWSIM.Inspector/PerfAn.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Imports System.IO
Imports Eto.Drawing
Imports Eto.Forms
Imports SkiaSharp
Imports c = DWSIM.UI.Shared.Common

Public Class PerfAn

Public Shared Function GetPerfAnWindow(solutionID As String) As TableLayout

'Layout

Dim content As New TableLayout With {.Padding = New Padding(10, 10, 10, 10), .Spacing = New Size(10, 10)}

Dim InspectorLabel = New Label With {.Text = "Solution Inspector / Performance Analyzer: " & Date.FromBinary(solutionID).ToString, .Font = SystemFonts.Bold(), .VerticalAlignment = VerticalAlignment.Bottom, .TextColor = Colors.White, .Height = 20}
InspectorLabel.Font = New Font(SystemFont.Bold, DWSIM.UI.Shared.Common.GetEditorFontSize())

Dim InspectorDescription = New Label With {.Text = "The Performance Analyzer displays information about the methods called by the models, including how many times they were called and the time spent on each call.", .VerticalAlignment = VerticalAlignment.Bottom, .TextColor = Colors.White, .Height = 20}
InspectorDescription.Font = New Font(SystemFont.Default, DWSIM.UI.Shared.Common.GetEditorFontSize())

Dim cbType, cbSubType As New DropDown

cbType.Items.Add("1")
cbSubType.Items.Add("2")

Dim cbTypeLabel = New Label With {.Text = "View", .Font = SystemFonts.Bold(), .VerticalAlignment = VerticalAlignment.Bottom, .TextColor = Colors.White, .Height = 20}
cbTypeLabel.Font = New Font(SystemFont.Bold, DWSIM.UI.Shared.Common.GetEditorFontSize())

Dim cbSubTypeLabel = New Label With {.Text = "Type", .VerticalAlignment = VerticalAlignment.Bottom, .TextColor = Colors.White, .Height = 20}
cbSubTypeLabel.Font = New Font(SystemFont.Default, DWSIM.UI.Shared.Common.GetEditorFontSize())

Dim tb As New TableLayout With {.Spacing = New Size(10, 10)}
tb.Rows.Add(New TableRow(cbTypeLabel, cbType, cbSubTypeLabel, cbSubType, Nothing))

content.BackgroundColor = New Color(0.051F, 0.447F, 0.651F)

content.Rows.Add(New TableRow(InspectorLabel))
content.Rows.Add(New TableRow(InspectorDescription))

content.Rows.Add(New TableRow(tb))

Dim skview As New Eto.Forms.Controls.SkiaSharp.Shared.SKControl
skview.Width = 1000
skview.Height = 1000

skview.PaintSurfaceAction = Sub(surface)
surface.Canvas.Clear(SKColors.White)
End Sub

content.Rows.Add(New TableRow(skview))

Return content

End Function

End Class
5 changes: 5 additions & 0 deletions DWSIM.Inspector/Window.vb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ Public Class Window

Dim btnPerfAn As New Button() With {.Text = "Performance Analyzer"}

AddHandler btnPerfAn.Click, Sub()
Dim f = c.GetDefaultEditorForm("DWSIM - Solution Inspector / Performance Analyzer", 1024, 768, PerfAn.GetPerfAnWindow(SetsBox.SelectedKey), False)
f.WindowState = WindowState.Maximized
f.Show()
End Sub

Dim l1 As New TableLayout(New TableRow(lblTools, Nothing, btnPerfAn, btnExportHTML))
'l1.Padding = New Padding(5, 5, 5, 5)
Expand Down
1 change: 1 addition & 0 deletions DWSIM.Inspector/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<packages>
<package id="Eto.Forms" version="2.4.1" targetFramework="net471" />
<package id="HtmlAgilityPack" version="1.4.9.5" targetFramework="net471" />
<package id="SkiaSharp" version="1.60.0" targetFramework="net471" />
<package id="System.ComponentModel" version="4.3.0" targetFramework="net471" />
<package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="net471" />
</packages>
2 changes: 1 addition & 1 deletion DWSIM.UI.Desktop.Forms/Forms/Flowsheet/Flowsheet.eto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void InitializeComponent()

ActInspector = () =>
{
var iform = Common.GetDefaultEditorForm("Solution Inspector", 1024, 768, DWSIM.Inspector.Window.GetInspectorWindow(), false);
var iform = Common.GetDefaultEditorForm("DWSIM - Solution Inspector", 1024, 768, DWSIM.Inspector.Window.GetInspectorWindow(), false);
iform.WindowState = WindowState.Maximized;
iform.Show();
};
Expand Down
Loading

0 comments on commit 0c0be9e

Please sign in to comment.