diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-01-31 11:38:36 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-01-31 11:38:36 +0200 |
| commit | 59fee3a258ff15567d21021b661f27d0a6958f8c (patch) | |
| tree | 3ddce746890ac8a40f35463308e1c5a05fd3ec59 /Software/Visual_Studio/PPC | |
| parent | c64b07d93d944a294df08cee553800a09757d6ec (diff) | |
| download | Tango-59fee3a258ff15567d21021b661f27d0a6958f8c.tar.gz Tango-59fee3a258ff15567d21021b661f27d0a6958f8c.zip | |
Some fixes.
Diffstat (limited to 'Software/Visual_Studio/PPC')
3 files changed, 25 insertions, 2 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml index df98cc903..5c358610f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml @@ -11,7 +11,7 @@ FontSize="{StaticResource TangoDefaultFontSize}" Foreground="{StaticResource TangoDarkForegroundBrush}" FontWeight="Medium" RenderOptions.BitmapScalingMode="LowQuality" SnapsToDevicePixels="True" UseLayoutRounding="True"> - <Grid> + <Grid x:Name="gridMain"> <views:MainView/> </Grid> </Window> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs index 765c792b1..4ca4a1fb7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs @@ -27,6 +27,7 @@ namespace Tango.PPC.UI public partial class MainWindow : Window { private String _technician_mode_buffer; + private Viewbox viewBox; public static MainWindow Instance { get; private set; } @@ -38,6 +39,8 @@ namespace Tango.PPC.UI _technician_mode_buffer = String.Empty; + bool has_touch = false; + #if !DESKTOP if (TouchHelper.IsTouchEnabled()) { @@ -56,14 +59,34 @@ namespace Tango.PPC.UI Top = touch_screen.Bounds.Top; Width = touch_screen.Bounds.Width; Height = touch_screen.Bounds.Height; + has_touch = true; } } #endif + if (!has_touch) + { + Viewbox viewBox = new Viewbox(); + viewBox.Stretch = Stretch.Uniform; + this.Content = viewBox; + gridMain.Width = 800; + gridMain.Height = 1280; + viewBox.Child = gridMain; + LockAspectRatio(); + this.SizeChanged += (x, y) => + { + LockAspectRatio(); + }; + } Closing += MainWindow_Closing; } + private void LockAspectRatio() + { + this.Width = (this.Height * (800d / 1280d)) - 10; + } + private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { Environment.Exit(0); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> + <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> </requestedPrivileges> </security> </trustInfo> |
