Skip to content

Commit

Permalink
update for props window
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5bfa committed Aug 28, 2024
1 parent 9f1d523 commit 3593cb1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Files.App/Utils/Storage/Helpers/FilePropertiesHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static nint GetWindowHandle(Window w)
=> WinRT.Interop.WindowNative.GetWindowHandle(w);

private static TaskCompletionSource? PropertiesWindowsClosingTCS;
private static readonly BlockingCollection<WindowEx> WindowCache = [];
private static readonly BlockingCollection<WinUIEx.WindowEx> WindowCache = [];

/// <summary>
/// Open properties window
Expand Down Expand Up @@ -103,13 +103,15 @@ public static void OpenPropertiesWindow(object item, IShellPage associatedInstan

if (!WindowCache.TryTake(out var propertiesWindow))
{
propertiesWindow = new(460, 550);
propertiesWindow = new();
propertiesWindow.Closed += PropertiesWindow_Closed;
}

var width = Convert.ToInt32(800 * App.AppModel.AppWindowDPI);
var height = Convert.ToInt32(500 * App.AppModel.AppWindowDPI);

propertiesWindow.MinHeight = 550;
propertiesWindow.MinWidth = 460;
propertiesWindow.AppWindow.Resize(new (width, height));
propertiesWindow.IsMinimizable = false;
propertiesWindow.IsMaximizable = false;
Expand Down Expand Up @@ -158,7 +160,7 @@ public static void OpenPropertiesWindow(object item, IShellPage associatedInstan
// So instead of destroying the Window object, cache it and reuse it as a workaround.
private static void PropertiesWindow_Closed(object sender, WindowEventArgs args)
{
if (!App.AppModel.IsMainWindowClosed && sender is WindowEx window)
if (!App.AppModel.IsMainWindowClosed && sender is WinUIEx.WindowEx window)
{
args.Handled = true;

Expand Down

0 comments on commit 3593cb1

Please sign in to comment.