Skip to content

Commit 146c06a

Browse files
committed
Add Transposed checkbox to WinowsForms ExampleBrowser (#1535)
1 parent 89dc2d1 commit 146c06a

4 files changed

Lines changed: 55 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ All notable changes to this project will be documented in this file.
2222
- Dash support to OxyPlot.ImageSharp
2323
- Clipping support to OxyPlot.ImageSharp
2424
- JpegExporter for OxyPlot.ImageSharp
25+
- WindowsForms ExampleBrowser can display transposed versions of examples (#1535)
2526

2627
### Changed
2728
- Legends model (#644)

Source/Examples/WindowsForms/ExampleBrowser/ExampleBrowser.WindowsForms.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
22
<PropertyGroup>
3-
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
3+
<TargetFrameworks>net461;netcoreapp3.1</TargetFrameworks>
44
<UseWindowsForms>true</UseWindowsForms>
55
<OutputType>WinExe</OutputType>
66
</PropertyGroup>

Source/Examples/WindowsForms/ExampleBrowser/MainForm.Designer.cs

Lines changed: 30 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/Examples/WindowsForms/ExampleBrowser/MainForm.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,32 @@ void TreeView1AfterSelect(object sender, TreeViewEventArgs e)
4747
{
4848
this.vm.SelectedExample = e.Node.Tag as ExampleInfo;
4949
this.InitPlot();
50+
51+
this.transposedCheck.Enabled = this.vm.SelectedExample?.IsTransposable ?? false;
5052
}
5153

5254
private void InitPlot()
5355
{
54-
this.plot1.Model = this.vm.SelectedExample != null ? this.vm.SelectedExample.PlotModel : null;
55-
this.plot1.Controller = this.vm.SelectedExample != null ? this.vm.SelectedExample.PlotController : null;
56+
if (this.vm.SelectedExample == null)
57+
{
58+
this.plot1.Model = null;
59+
this.plot1.Controller = null;
60+
}
61+
else if (transposedCheck.Checked && this.vm.SelectedExample.IsTransposable)
62+
{
63+
this.plot1.Model = this.vm.SelectedExample.TransposedPlotModel;
64+
this.plot1.Controller = this.vm.SelectedExample.TransposedPlotController;
65+
}
66+
else
67+
{
68+
this.plot1.Model = this.vm.SelectedExample.PlotModel;
69+
this.plot1.Controller = this.vm.SelectedExample.PlotController;
70+
}
71+
}
72+
73+
private void transposedCheck_CheckedChanged(object sender, System.EventArgs e)
74+
{
75+
InitPlot();
5676
}
5777
}
58-
}
78+
}

0 commit comments

Comments
 (0)