diff options
| author | Roy <Roy.mail.net@gmail.com> | 2023-04-26 16:23:07 +0300 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2023-04-26 16:23:07 +0300 |
| commit | 07a75244fe05eb4b2b0b628ec8f038cced238579 (patch) | |
| tree | 77c9d16c2632e2f0f36a533cf6e0bff2ffac0de9 /Software/Visual_Studio/PPC/Tango.PPC.UI | |
| parent | f86efbca4aac00a1a4e6d290feca1a0236c2d828 (diff) | |
| download | Tango-07a75244fe05eb4b2b0b628ec8f038cced238579.tar.gz Tango-07a75244fe05eb4b2b0b628ec8f038cced238579.zip | |
Eureka UI Screen.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
5 files changed, 69 insertions, 16 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Helpers/DpiHelper.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Helpers/DpiHelper.cs new file mode 100644 index 000000000..0d0ac9f1e --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Helpers/DpiHelper.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.UI.Helpers +{ + public static class DpiHelper + { + private enum ProcessDPIAwareness + { + ProcessDPIUnaware = 0, + ProcessSystemDPIAware = 1, + ProcessPerMonitorDPIAware = 2 + } + + [DllImport("shcore.dll")] + private static extern int SetProcessDpiAwareness(ProcessDPIAwareness value); + + public static void SetDpiAwareness() + { + try + { + if (Environment.OSVersion.Version.Major >= 6) + { + SetProcessDpiAwareness(ProcessDPIAwareness.ProcessPerMonitorDPIAware); + } + } + catch (EntryPointNotFoundException)//this exception occures if OS does not implement this API, just ignore it. + { + } + } + } +} 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 b7f6c40ae..1cfa60f92 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs @@ -21,6 +21,7 @@ using Tango.Core.DI; using Tango.PPC.Common.Application; using Tango.PPC.Common.Build; using Tango.PPC.UI.Build; +using Tango.PPC.UI.Helpers; using Tango.Touch.Helpers; namespace Tango.PPC.UI @@ -68,17 +69,32 @@ namespace Tango.PPC.UI var screens = System.Windows.Forms.Screen.AllScreens; var touch_screen = screens.Last(); - WindowStyle = WindowStyle.SingleBorderWindow; - ResizeMode = ResizeMode.CanResize; - Width = 1280; - Height = 720; - WindowStartupLocation = WindowStartupLocation.CenterScreen; - WindowState = WindowState.Normal; - Topmost = false; // sure? - //Left = touch_screen.Bounds.Left; - //Top = touch_screen.Bounds.Top; - //Width = touch_screen.Bounds.Width; - //Height = touch_screen.Bounds.Height; + + bool hasTouch = TouchHelper.IsTouchEnabled(); + + if (!hasTouch) + { + WindowStyle = WindowStyle.SingleBorderWindow; + ResizeMode = ResizeMode.CanResize; + Width = 1280; + Height = 720; + WindowStartupLocation = WindowStartupLocation.CenterScreen; + WindowState = WindowState.Normal; + Topmost = false; // sure? + } + else + { + WindowState = WindowState.Normal; + WindowStyle = WindowStyle.None; + ResizeMode = ResizeMode.NoResize; + Left = screens.Length == 2 ? screens[0].Bounds.Width : 0; + Top = 0; + Width = 1920; + Height = 1080; + WindowStartupLocation = WindowStartupLocation.Manual; + Topmost = false; // sure? + } + //App.Current.Resources["TangoPanelMaskColor"] = App.Current.Resources["TangoPanelMaskColorLight"]; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index bb67015e9..af76c09ce 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -203,6 +203,7 @@ </Compile> <Compile Include="Dialogs\FirmwareUpgradeFromFileViewVM.cs" /> <Compile Include="Dialogs\UpdateFromFileViewVM.cs" /> + <Compile Include="Helpers\DpiHelper.cs" /> <Compile Include="InternalModule.cs" /> <Compile Include="Modules\DefaultPPCModuleLoader.cs" /> <Compile Include="Navigation\DefaultNavigationManager.cs" /> @@ -892,7 +893,7 @@ if $(ConfigurationName) == Debug "rc.exe" "$(TargetPath)" --set-version-string " </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml index d827205f8..a2d0d5930 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml @@ -204,8 +204,8 @@ </Grid> </Grid> - <Grid Background="Gainsboro" Grid.Column="2" Width="1260" Height="1280"> - <Viewbox > + <Grid Background="Gainsboro" Grid.Column="2"> + <Viewbox> <local:MachineStatusView /> </Viewbox> </Grid> @@ -213,7 +213,7 @@ <Grid Grid.Column="1" Background="{StaticResource TangoPrimaryBackgroundBrush}"> <Grid> <!--<Viewbox>--> - <touch:TouchPanelEureka Width="800" Height="1280" + <touch:TouchPanelEureka Margin="0 -40 0 0" Width="900" Height="1445" HasMessageBox="{Binding NotificationProvider.HasMessageBox}" CurrentMessageBox="{Binding NotificationProvider.CurrentMessageBox}" HasDialog="{Binding NotificationProvider.HasDialog}" diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml index 25841cb94..9ee64f4a8 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -119,7 +119,7 @@ </UserControl.Resources> - <Grid Width="1260" Height="1280"> + <Grid Width="1246" Height="1400"> <Grid.ColumnDefinitions> <ColumnDefinition Width="32"></ColumnDefinition> <ColumnDefinition Width="1*"></ColumnDefinition> |
