From ce8d784a4feeefe0b59d066673883fd4e5a25e03 Mon Sep 17 00:00:00 2001 From: vishg13 Date: Fri, 3 Oct 2025 16:32:43 -0400 Subject: [PATCH] Feat(StatusCenter): Make Status Center resizable and remember size --- .../Files.App.Launcher.vcxproj | 4 +- .../Files.App.OpenDialog.Win32.vcxproj | 25 +++------- .../Files.App.OpenDialog.vcxproj | 25 +++------- .../Files.App.SaveDialog.Win32.vcxproj | 24 +++------- .../Files.App.SaveDialog.vcxproj | 22 ++------- .../Files.App.Launcher.exe.sha256 | 2 +- .../StatusCenter/StatusCenter.xaml | 19 ++++++-- .../StatusCenter/StatusCenter.xaml.cs | 48 ++++++++++++++++++- 8 files changed, 89 insertions(+), 80 deletions(-) diff --git a/src/Files.App.Launcher/Files.App.Launcher.vcxproj b/src/Files.App.Launcher/Files.App.Launcher.vcxproj index 1b7ac20e96db..2a34bcbf1358 100644 --- a/src/Files.App.Launcher/Files.App.Launcher.vcxproj +++ b/src/Files.App.Launcher/Files.App.Launcher.vcxproj @@ -37,7 +37,7 @@ Application true - v143 + v145 Unicode true ..\..\artifacts\$(Configuration)\$(Platform)\$(MSBuildProjectName)\ @@ -45,7 +45,7 @@ Application false - v143 + v145 true Unicode false diff --git a/src/Files.App.OpenDialog/Files.App.OpenDialog.Win32.vcxproj b/src/Files.App.OpenDialog/Files.App.OpenDialog.Win32.vcxproj index a9dca5ab0bda..d072282809f8 100644 --- a/src/Files.App.OpenDialog/Files.App.OpenDialog.Win32.vcxproj +++ b/src/Files.App.OpenDialog/Files.App.OpenDialog.Win32.vcxproj @@ -1,6 +1,5 @@  - Debug @@ -27,7 +26,6 @@ x64 - 16.0 {B3FE3F3B-CECC-4918-B72B-5488C3774125} @@ -35,14 +33,12 @@ 10.0 DynamicLibrary true - v143 + v145 Unicode - - true true @@ -50,7 +46,6 @@ ..\..\artifacts\intermediates\$(Platform)\$(MSBuildProjectName)\ Files.App.OpenDialog$(PlatformArchitecture) - true false @@ -59,7 +54,6 @@ ..\..\artifacts\intermediates\$(Platform)\$(MSBuildProjectName)\ Files.App.OpenDialog$(PlatformArchitecture) - Use @@ -91,7 +85,6 @@ xcopy /s /y "$(ProjectDir)$(OutDir)*.dll" "$(ProjectDir)..\..\src\Files.App\Assets\FilesOpenDialog" - Disabled @@ -105,7 +98,6 @@ _DEBUG;%(PreprocessorDefinitions) - Disabled @@ -118,7 +110,6 @@ _DEBUG;%(PreprocessorDefinitions) - Disabled @@ -131,7 +122,6 @@ _DEBUG;%(PreprocessorDefinitions) - MaxSpeed @@ -149,7 +139,6 @@ true - MaxSpeed @@ -166,7 +155,6 @@ true - MaxSpeed @@ -183,7 +171,6 @@ true - @@ -196,11 +183,13 @@ false - + + false - + + @@ -212,7 +201,5 @@ - - - + \ No newline at end of file diff --git a/src/Files.App.OpenDialog/Files.App.OpenDialog.vcxproj b/src/Files.App.OpenDialog/Files.App.OpenDialog.vcxproj index 360f87f88699..d77c8863ef63 100644 --- a/src/Files.App.OpenDialog/Files.App.OpenDialog.vcxproj +++ b/src/Files.App.OpenDialog/Files.App.OpenDialog.vcxproj @@ -1,6 +1,5 @@  - Debug @@ -27,7 +26,6 @@ x64 - 16.0 {A2FF3F3B-8EBC-4108-B99D-1476B7876656} @@ -35,14 +33,12 @@ 10.0 DynamicLibrary true - v143 + v145 Unicode - - true true @@ -50,7 +46,6 @@ ..\..\artifacts\intermediates\$(Platform)\$(MSBuildProjectName)\ Files.App.OpenDialog$(PlatformArchitecture) - true false @@ -59,7 +54,6 @@ ..\..\artifacts\intermediates\$(Platform)\$(MSBuildProjectName)\ Files.App.OpenDialog$(PlatformArchitecture) - Use @@ -91,7 +85,6 @@ xcopy /s /y "$(ProjectDir)$(OutDir)*.dll" "$(ProjectDir)..\..\src\Files.App\Assets\FilesOpenDialog" - Disabled @@ -105,7 +98,6 @@ _DEBUG;%(PreprocessorDefinitions) - Disabled @@ -118,7 +110,6 @@ _DEBUG;%(PreprocessorDefinitions) - Disabled @@ -131,7 +122,6 @@ _DEBUG;%(PreprocessorDefinitions) - MaxSpeed @@ -149,7 +139,6 @@ true - MaxSpeed @@ -166,7 +155,6 @@ true - MaxSpeed @@ -183,7 +171,6 @@ true - @@ -196,11 +183,13 @@ false - + + false - + + @@ -212,7 +201,5 @@ - - - + \ No newline at end of file diff --git a/src/Files.App.SaveDialog/Files.App.SaveDialog.Win32.vcxproj b/src/Files.App.SaveDialog/Files.App.SaveDialog.Win32.vcxproj index 4e10f8e97c96..3cb9077c6b9e 100644 --- a/src/Files.App.SaveDialog/Files.App.SaveDialog.Win32.vcxproj +++ b/src/Files.App.SaveDialog/Files.App.SaveDialog.Win32.vcxproj @@ -26,7 +26,6 @@ x64 - 16.0 {7756A1A4-17B5-4E6B-9B12-F19AA868A225} @@ -34,14 +33,12 @@ 10.0 DynamicLibrary true - v143 + v145 Unicode - - true true @@ -49,7 +46,6 @@ ..\..\artifacts\intermediates\$(Platform)\$(MSBuildProjectName)\ Files.App.SaveDialog$(PlatformArchitecture) - true false @@ -58,7 +54,6 @@ ..\..\artifacts\intermediates\$(Platform)\$(MSBuildProjectName)\ Files.App.SaveDialog$(PlatformArchitecture) - Use @@ -90,7 +85,6 @@ xcopy /s /y "$(ProjectDir)$(OutDir)*.dll" "$(ProjectDir)..\..\src\Files.App\Assets\FilesOpenDialog" - Disabled @@ -104,7 +98,6 @@ _DEBUG;%(PreprocessorDefinitions) - Disabled @@ -117,7 +110,6 @@ _DEBUG;%(PreprocessorDefinitions) - Disabled @@ -130,7 +122,6 @@ _DEBUG;%(PreprocessorDefinitions) - MaxSpeed @@ -148,7 +139,6 @@ true - MaxSpeed @@ -165,7 +155,6 @@ true - MaxSpeed @@ -182,7 +171,6 @@ true - @@ -196,11 +184,13 @@ false - + + false - + + @@ -213,7 +203,5 @@ - - - + \ No newline at end of file diff --git a/src/Files.App.SaveDialog/Files.App.SaveDialog.vcxproj b/src/Files.App.SaveDialog/Files.App.SaveDialog.vcxproj index 23fc93e0b6e2..098d63c7cbd8 100644 --- a/src/Files.App.SaveDialog/Files.App.SaveDialog.vcxproj +++ b/src/Files.App.SaveDialog/Files.App.SaveDialog.vcxproj @@ -25,7 +25,6 @@ x64 - 16.0 {EBFA367F-CBDB-4CD0-B838-D6B95F61D1F6} @@ -33,14 +32,12 @@ 10.0 DynamicLibrary true - v143 + v145 Unicode - - true true @@ -48,7 +45,6 @@ ..\..\artifacts\intermediates\$(Platform)\$(MSBuildProjectName)\ Files.App.SaveDialog$(PlatformArchitecture) - true false @@ -57,7 +53,6 @@ ..\..\artifacts\intermediates\$(Platform)\$(MSBuildProjectName)\ Files.App.SaveDialog$(PlatformArchitecture) - Use @@ -89,7 +84,6 @@ xcopy /s /y "$(ProjectDir)$(OutDir)*.dll" "$(ProjectDir)..\..\src\Files.App\Assets\FilesOpenDialog" - Disabled @@ -103,7 +97,6 @@ _DEBUG;%(PreprocessorDefinitions) - Disabled @@ -116,7 +109,6 @@ _DEBUG;%(PreprocessorDefinitions) - Disabled @@ -129,7 +121,6 @@ _DEBUG;%(PreprocessorDefinitions) - MaxSpeed @@ -147,7 +138,6 @@ true - MaxSpeed @@ -164,7 +154,6 @@ true - MaxSpeed @@ -181,7 +170,6 @@ true - @@ -195,11 +183,13 @@ false - + + false - + + @@ -212,7 +202,5 @@ - - \ No newline at end of file diff --git a/src/Files.App/Assets/FilesOpenDialog/Files.App.Launcher.exe.sha256 b/src/Files.App/Assets/FilesOpenDialog/Files.App.Launcher.exe.sha256 index 11864831640e..e8f585c7743f 100644 --- a/src/Files.App/Assets/FilesOpenDialog/Files.App.Launcher.exe.sha256 +++ b/src/Files.App/Assets/FilesOpenDialog/Files.App.Launcher.exe.sha256 @@ -1 +1 @@ -cb1ca000ef2f03f1afc7bde9ed4fb2987669c89a58b63919e67574696091f60f +9724def65d78a6d5b72d21a52c2ed2f09eeafd481b35b0859a0a1a5f6011a8f6 diff --git a/src/Files.App/UserControls/StatusCenter/StatusCenter.xaml b/src/Files.App/UserControls/StatusCenter/StatusCenter.xaml index faa36f1f9419..d9517303a8d1 100644 --- a/src/Files.App/UserControls/StatusCenter/StatusCenter.xaml +++ b/src/Files.App/UserControls/StatusCenter/StatusCenter.xaml @@ -9,6 +9,7 @@ xmlns:local="using:Files.App.UserControls.StatusCenter" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:statuscenter="using:Files.App.Utils.StatusCenter" + xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives" mc:Ignorable="d"> @@ -19,7 +20,7 @@ - + @@ -357,7 +358,7 @@ - + - + + + + diff --git a/src/Files.App/UserControls/StatusCenter/StatusCenter.xaml.cs b/src/Files.App/UserControls/StatusCenter/StatusCenter.xaml.cs index 8798d39d46f5..9d5517431ee0 100644 --- a/src/Files.App/UserControls/StatusCenter/StatusCenter.xaml.cs +++ b/src/Files.App/UserControls/StatusCenter/StatusCenter.xaml.cs @@ -4,6 +4,8 @@ using CommunityToolkit.WinUI; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Windows.Storage; namespace Files.App.UserControls.StatusCenter { @@ -11,11 +13,40 @@ public sealed partial class StatusCenter : UserControl { public StatusCenterViewModel ViewModel; + const string WidthKey = "StatusCenterWidth"; + const string HeightKey = "StatusCenterHeight"; + public StatusCenter() { InitializeComponent(); - ViewModel = Ioc.Default.GetRequiredService(); + + Loaded += (s, e) => + { + var (w, h) = LoadStatusCenterSize(); + if (w.HasValue && h.HasValue) + { + RootGrid.Width = Math.Max(w.Value, RootGrid.MinWidth); + RootGrid.Height = Math.Max(h.Value, RootGrid.MinHeight); + } + + ResizeGrip.DragDelta += (s1, e1) => + { + double currentW = double.IsNaN(RootGrid.Width) ? RootGrid.ActualWidth : RootGrid.Width; + double currentH = double.IsNaN(RootGrid.Height) ? RootGrid.ActualHeight : RootGrid.Height; + + double newW = Math.Max(currentW - e1.HorizontalChange, RootGrid.MinWidth); + double newH = Math.Max(currentH + e1.VerticalChange, RootGrid.MinHeight); + + RootGrid.Width = newW; + RootGrid.Height = newH; + }; + + ResizeGrip.DragCompleted += (s2, e2) => + { + SaveStatusCenterSize(RootGrid.Width, RootGrid.Height); + }; + }; } private void CloseAllItemsButton_Click(object sender, RoutedEventArgs e) @@ -41,5 +72,20 @@ private void ExpandCollapseChevronItemButton_Click(object sender, RoutedEventArg item.IsExpanded = !item.IsExpanded; } } + + void SaveStatusCenterSize(double width, double height) + { + var local = ApplicationData.Current.LocalSettings; + local.Values[WidthKey] = width; + local.Values[HeightKey] = height; + } + + (double? width, double? height) LoadStatusCenterSize() + { + var local = ApplicationData.Current.LocalSettings; + double? w = local.Values.TryGetValue(WidthKey, out var vw) && vw is double dw ? dw : null; + double? h = local.Values.TryGetValue(HeightKey, out var vh) && vh is double dh ? dh : null; + return (w, h); + } } }