diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Settings/DockSettings.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Settings/DockSettings.cs
index cad04ced7a..173faf40cd 100644
--- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Settings/DockSettings.cs
+++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Settings/DockSettings.cs
@@ -101,7 +101,6 @@ public enum DockSize
public enum DockBackdrop
{
- Mica,
Transparent,
Acrylic,
}
diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockSettingsToViews.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockSettingsToViews.cs
index d7826551aa..bbcf14d3c5 100644
--- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockSettingsToViews.cs
+++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockSettingsToViews.cs
@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using Microsoft.CmdPal.UI.ViewModels.Settings;
-using Microsoft.UI.Xaml.Media;
using Windows.Win32;
using WinUIEx;
@@ -64,7 +63,6 @@ internal static class DockSettingsToViews
{
return backdrop switch
{
- DockBackdrop.Mica => new MicaBackdrop(),
DockBackdrop.Transparent => new TransparentTintBackdrop(),
DockBackdrop.Acrylic => null, // new DesktopAcrylicBackdrop(),
_ => throw new NotImplementedException(),
diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockAppearancePage.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockAppearancePage.xaml
deleted file mode 100644
index a8e136ee94..0000000000
--- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockAppearancePage.xaml
+++ /dev/null
@@ -1,181 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockAppearancePage.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockAppearancePage.xaml.cs
deleted file mode 100644
index b2f83412c9..0000000000
--- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockAppearancePage.xaml.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) Microsoft Corporation
-// The Microsoft Corporation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using ManagedCommon;
-using Microsoft.CmdPal.UI.ViewModels;
-using Microsoft.CmdPal.UI.ViewModels.Services;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.UI;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Documents;
-using Microsoft.Windows.Storage.Pickers;
-
-namespace Microsoft.CmdPal.UI.Settings;
-
-///
-/// Settings page for configuring the appearance of the dock.
-///
-public sealed partial class DockAppearancePage : Page
-{
- private readonly TaskScheduler _mainTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
-
- internal SettingsViewModel ViewModel { get; }
-
- public DockAppearancePage()
- {
- InitializeComponent();
-
- var settings = App.Current.Services.GetService()!;
- var themeService = App.Current.Services.GetRequiredService();
- var topLevelCommandManager = App.Current.Services.GetService()!;
- ViewModel = new SettingsViewModel(settings, topLevelCommandManager, _mainTaskScheduler, themeService);
- }
-
- private async void PickBackgroundImage_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- if (XamlRoot?.ContentIslandEnvironment is null)
- {
- return;
- }
-
- var windowId = XamlRoot?.ContentIslandEnvironment?.AppWindowId ?? new WindowId(0);
-
- var picker = new FileOpenPicker(windowId)
- {
- CommitButtonText = ViewModels.Properties.Resources.builtin_settings_appearance_pick_background_image_title!,
- SuggestedStartLocation = PickerLocationId.PicturesLibrary,
- ViewMode = PickerViewMode.Thumbnail,
- };
-
- string[] extensions = [".png", ".bmp", ".jpg", ".jpeg", ".jfif", ".gif", ".tiff", ".tif", ".webp", ".jxr"];
- foreach (var ext in extensions)
- {
- picker.FileTypeFilter!.Add(ext);
- }
-
- var file = await picker.PickSingleFileAsync()!;
- if (file != null)
- {
- ViewModel.DockAppearance.BackgroundImagePath = file.Path ?? string.Empty;
- }
- }
- catch (Exception ex)
- {
- Logger.LogError("Failed to pick background image file for dock", ex);
- }
- }
-
- private void OpenWindowsColorsSettings_Click(Hyperlink sender, HyperlinkClickEventArgs args)
- {
- // LOAD BEARING (or BEAR LOADING?): Process.Start with UseShellExecute inside a XAML input event can trigger WinUI reentrancy
- // and cause FailFast crashes. Task.Run moves the call off the UI thread to prevent hard process termination.
- Task.Run(() =>
- {
- try
- {
- _ = Process.Start(new ProcessStartInfo("ms-settings:colors") { UseShellExecute = true });
- }
- catch (Exception ex)
- {
- Logger.LogError("Failed to open Windows Settings", ex);
- }
- });
- }
-}
diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockSettingsPage.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockSettingsPage.xaml
index d0a278e1cf..2a2059bdc7 100644
--- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockSettingsPage.xaml
+++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockSettingsPage.xaml
@@ -73,21 +73,6 @@
-
-
-
- Choose the background effect for your dock
-
-
-
-
-
-
-
-
@@ -98,9 +83,162 @@
IsOn="{x:Bind ShowLabels, Mode=TwoWay}"
OffContent="Hide labels"
OnContent="Show Labels" />
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockSettingsPage.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockSettingsPage.xaml.cs
index f981581570..18bf976836 100644
--- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockSettingsPage.xaml.cs
+++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/DockSettingsPage.xaml.cs
@@ -2,12 +2,17 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System.Diagnostics;
+using ManagedCommon;
using Microsoft.CmdPal.UI.ViewModels;
using Microsoft.CmdPal.UI.ViewModels.Dock;
using Microsoft.CmdPal.UI.ViewModels.Services;
using Microsoft.CmdPal.UI.ViewModels.Settings;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Documents;
+using Microsoft.Windows.Storage.Pickers;
namespace Microsoft.CmdPal.UI.Settings;
@@ -15,7 +20,7 @@ public sealed partial class DockSettingsPage : Page
{
private readonly TaskScheduler _mainTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
- private readonly SettingsViewModel viewModel;
+ internal SettingsViewModel ViewModel { get; }
public List AllDockBandItems => GetAllBandSettings();
@@ -27,7 +32,7 @@ public sealed partial class DockSettingsPage : Page
var themeService = App.Current.Services.GetService()!;
var topLevelCommandManager = App.Current.Services.GetService()!;
- viewModel = new SettingsViewModel(settings, topLevelCommandManager, _mainTaskScheduler, themeService);
+ ViewModel = new SettingsViewModel(settings, topLevelCommandManager, _mainTaskScheduler, themeService);
// Initialize UI state
InitializeSettings();
@@ -41,29 +46,82 @@ public sealed partial class DockSettingsPage : Page
BackdropComboBox.SelectedIndex = SelectedBackdropIndex;
}
+ private async void PickBackgroundImage_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (XamlRoot?.ContentIslandEnvironment is null)
+ {
+ return;
+ }
+
+ var windowId = XamlRoot?.ContentIslandEnvironment?.AppWindowId ?? new Microsoft.UI.WindowId(0);
+
+ var picker = new FileOpenPicker(windowId)
+ {
+ CommitButtonText = ViewModels.Properties.Resources.builtin_settings_appearance_pick_background_image_title!,
+ SuggestedStartLocation = PickerLocationId.PicturesLibrary,
+ ViewMode = PickerViewMode.Thumbnail,
+ };
+
+ string[] extensions = [".png", ".bmp", ".jpg", ".jpeg", ".jfif", ".gif", ".tiff", ".tif", ".webp", ".jxr"];
+ foreach (var ext in extensions)
+ {
+ picker.FileTypeFilter!.Add(ext);
+ }
+
+ var file = await picker.PickSingleFileAsync()!;
+ if (file != null)
+ {
+ ViewModel.DockAppearance.BackgroundImagePath = file.Path ?? string.Empty;
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.LogError("Failed to pick background image file for dock", ex);
+ }
+ }
+
+ private void OpenWindowsColorsSettings_Click(Hyperlink sender, HyperlinkClickEventArgs args)
+ {
+ // LOAD BEARING (or BEAR LOADING?): Process.Start with UseShellExecute inside a XAML input event can trigger WinUI reentrancy
+ // and cause FailFast crashes. Task.Run moves the call off the UI thread to prevent hard process termination.
+ Task.Run(() =>
+ {
+ try
+ {
+ _ = Process.Start(new ProcessStartInfo("ms-settings:colors") { UseShellExecute = true });
+ }
+ catch (Exception ex)
+ {
+ Logger.LogError("Failed to open Windows Settings", ex);
+ }
+ });
+ }
+
// Property bindings for ComboBoxes
public int SelectedDockSizeIndex
{
- get => DockSizeToSelectedIndex(viewModel.Dock_DockSize);
- set => viewModel.Dock_DockSize = SelectedIndexToDockSize(value);
+ get => DockSizeToSelectedIndex(ViewModel.Dock_DockSize);
+ set => ViewModel.Dock_DockSize = SelectedIndexToDockSize(value);
}
public int SelectedSideIndex
{
- get => SideToSelectedIndex(viewModel.Dock_Side);
- set => viewModel.Dock_Side = SelectedIndexToSide(value);
+ get => SideToSelectedIndex(ViewModel.Dock_Side);
+ set => ViewModel.Dock_Side = SelectedIndexToSide(value);
}
public int SelectedBackdropIndex
{
- get => BackdropToSelectedIndex(viewModel.Dock_Backdrop);
- set => viewModel.Dock_Backdrop = SelectedIndexToBackdrop(value);
+ get => BackdropToSelectedIndex(ViewModel.Dock_Backdrop);
+ set => ViewModel.Dock_Backdrop = SelectedIndexToBackdrop(value);
}
public bool ShowLabels
{
- get => viewModel.Dock_ShowLabels;
- set => viewModel.Dock_ShowLabels = value;
+ get => ViewModel.Dock_ShowLabels;
+ set => ViewModel.Dock_ShowLabels = value;
}
// Conversion methods for ComboBox bindings
@@ -103,17 +161,15 @@ public sealed partial class DockSettingsPage : Page
private static int BackdropToSelectedIndex(DockBackdrop backdrop) => backdrop switch
{
- DockBackdrop.Mica => 0,
- DockBackdrop.Transparent => 1,
- DockBackdrop.Acrylic => 2,
+ DockBackdrop.Transparent => 0,
+ DockBackdrop.Acrylic => 1,
_ => 2,
};
private static DockBackdrop SelectedIndexToBackdrop(int index) => index switch
{
- 0 => DockBackdrop.Mica,
- 1 => DockBackdrop.Transparent,
- 2 => DockBackdrop.Acrylic,
+ 0 => DockBackdrop.Transparent,
+ 1 => DockBackdrop.Acrylic,
_ => DockBackdrop.Acrylic,
};
diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/SettingsWindow.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/SettingsWindow.xaml
index 5bec51652b..641f975d79 100644
--- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/SettingsWindow.xaml
+++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/SettingsWindow.xaml
@@ -78,11 +78,6 @@
x:Uid="Settings_GeneralPage_NavigationViewItem_Dock"
Icon="{ui:FontIcon Glyph=}"
Tag="Dock" />
-
diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/SettingsWindow.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/SettingsWindow.xaml.cs
index 14a963d0fd..1b78fce161 100644
--- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/SettingsWindow.xaml.cs
+++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Settings/SettingsWindow.xaml.cs
@@ -109,7 +109,6 @@ public sealed partial class SettingsWindow : WindowEx,
"Appearance" => typeof(AppearancePage),
"Extensions" => typeof(ExtensionsPage),
"Dock" => typeof(DockSettingsPage),
- "DockAppearance" => typeof(DockAppearancePage),
_ => null,
};