|
15 | 15 | using Microsoft.UI.Dispatching; |
16 | 16 | using Windows.ApplicationModel.DataTransfer; |
17 | 17 | using Windows.Graphics; |
| 18 | +using Windows.Graphics.Display; |
18 | 19 |
|
19 | 20 | namespace AzureKeyVaultStudio.Presentation.ViewModels; |
20 | 21 |
|
@@ -215,7 +216,12 @@ private void NewSecret() |
215 | 216 | (vm as IDisposable)?.Dispose(); |
216 | 217 | }; |
217 | 218 |
|
218 | | - window.AppWindow.Resize(new SizeInt32 { Width = 640, Height = 680 }); |
| 219 | + |
| 220 | + if (OperatingSystem.IsMacOS()) |
| 221 | + ResizeWindowScaled(window.AppWindow, 640, 680); |
| 222 | + else |
| 223 | + window.AppWindow.Resize(new SizeInt32 { Width = 640, Height = 680 }); |
| 224 | + |
219 | 225 | window.AppWindow.Show(); |
220 | 226 | } |
221 | 227 |
|
@@ -778,6 +784,13 @@ private async Task Refresh(CancellationToken token) |
778 | 784 | await FilterAndLoadVaultValueTypeCommand.ExecuteAsync(token); |
779 | 785 | } |
780 | 786 |
|
| 787 | + private static void ResizeWindowScaled(Microsoft.UI.Windowing.AppWindow appWindow, int logicalWidth, int logicalHeight) |
| 788 | + { |
| 789 | + //https://github.com/unoplatform/uno/issues/22217 |
| 790 | + var scale = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel; |
| 791 | + appWindow.Resize(new SizeInt32 { Width = (int)(logicalWidth * scale), Height = (int)(logicalHeight * scale) }); |
| 792 | + } |
| 793 | + |
781 | 794 | private void ShowInAppNotification(string subject, string message, InfoBarSeverity notificationType) |
782 | 795 | { |
783 | 796 | WeakReferenceMessenger.Default.Send(new SendInAppNotificationMessage(new Notification |
@@ -846,7 +859,12 @@ private async Task ShowProperties(KeyVaultItemProperties model) |
846 | 859 | { |
847 | 860 | (itemVm as IDisposable)?.Dispose(); |
848 | 861 | }; |
849 | | - window.AppWindow.Resize(new SizeInt32 { Width = 620, Height = 580 }); |
| 862 | + |
| 863 | + if (OperatingSystem.IsMacOS()) |
| 864 | + ResizeWindowScaled(window.AppWindow, 620, 680); |
| 865 | + else |
| 866 | + window.AppWindow.Resize(new SizeInt32 { Width = 640, Height = 680 }); |
| 867 | + |
850 | 868 | if (Application.Current is App app && app.MainWindow is Window mainWindow) |
851 | 869 | { |
852 | 870 | var mainPos = mainWindow.AppWindow.Position; |
|
0 commit comments