diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/UpdatingSettings.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/UpdatingSettings.cs index 585bbb972..5325aaf8e 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/UpdatingSettings.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.Library/UpdatingSettings.cs @@ -71,9 +71,17 @@ namespace Microsoft.PowerToys.Settings.UI.Library { try { - long seconds = long.Parse(LastCheckedDate, CultureInfo.CurrentCulture); - var date = DateTimeOffset.FromUnixTimeSeconds(seconds).UtcDateTime; - return date.ToLocalTime().ToString(CultureInfo.CurrentCulture); + // TODO(stefan) revert this + if (LastCheckedDate != null) + { + long seconds = long.Parse(LastCheckedDate, CultureInfo.CurrentCulture); + var date = DateTimeOffset.FromUnixTimeSeconds(seconds).UtcDateTime; + return date.ToLocalTime().ToString(CultureInfo.CurrentCulture); + } + else + { + return DateTime.UtcNow.ToString(CultureInfo.CurrentCulture); + } } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception) diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Controls/ShortcutControl/ShortcutControl.xaml.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Controls/ShortcutControl/ShortcutControl.xaml.cs index 90385c2e8..a722a3680 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Controls/ShortcutControl/ShortcutControl.xaml.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Controls/ShortcutControl/ShortcutControl.xaml.cs @@ -90,7 +90,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Controls this.Unloaded += ShortcutControl_Unloaded; hook = new HotkeySettingsControlHook(Hotkey_KeyDown, Hotkey_KeyUp, Hotkey_IsActive, FilterAccessibleKeyboardEvents); - ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView(); + ResourceLoader resourceLoader = ResourceLoader.GetForViewIndependentUse(); // We create the Dialog in C# because doing it in XAML is giving WinUI/XAML Island bugs when using dark theme. shortcutDialog = new ContentDialog diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Converters/ImageResizerFitToStringConverter.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Converters/ImageResizerFitToStringConverter.cs index 619068fcd..5502ed110 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Converters/ImageResizerFitToStringConverter.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Converters/ImageResizerFitToStringConverter.cs @@ -22,9 +22,9 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Converters string targetValue = string.Empty; switch (value) { - case 0: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Fit_Fill_ThirdPersonSingular"); break; - case 1: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Fit_Fit_ThirdPersonSingular"); break; - case 2: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Fit_Stretch_ThirdPersonSingular"); break; + case 0: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Fit_Fill_ThirdPersonSingular"); break; + case 1: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Fit_Fit_ThirdPersonSingular"); break; + case 2: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Fit_Stretch_ThirdPersonSingular"); break; } if (toLower) diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Converters/ImageResizerUnitToStringConverter.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Converters/ImageResizerUnitToStringConverter.cs index 914c58e11..010d8872e 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Converters/ImageResizerUnitToStringConverter.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Converters/ImageResizerUnitToStringConverter.cs @@ -22,10 +22,10 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Converters string targetValue = string.Empty; switch (value) { - case 0: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Unit_Centimeter"); break; - case 1: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Unit_Inch"); break; - case 2: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Unit_Percent"); break; - case 3: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Unit_Pixel"); break; + case 0: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Unit_Centimeter"); break; + case 1: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Unit_Inch"); break; + case 2: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Unit_Percent"); break; + case 3: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Unit_Pixel"); break; } if (toLower) diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/MainWindow.xaml.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/MainWindow.xaml.cs index fd27b06bb..235c8f36a 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/MainWindow.xaml.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/MainWindow.xaml.cs @@ -27,10 +27,5 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3 { this.InitializeComponent(); } - - private void myButton_Click(object sender, RoutedEventArgs e) - { - // myButton.Content = "Clicked"; - } } } diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Strings/en-us/Resources.resw b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Strings/en-us/Resources.resw index 1395c4ea3..6d39edbd6 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Strings/en-us/Resources.resw +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Strings/en-us/Resources.resw @@ -283,10 +283,12 @@ Remap a key Keyboard Manager remap keyboard button content + Keys Keyboard Manager remap keyboard header @@ -295,10 +297,12 @@ Remap a shortcut Keyboard Manager remap shortcuts button + Shortcuts Keyboard Manager remap keyboard header @@ -309,12 +313,14 @@ Shortcut + Key Remapping key as in keyboard key @@ -478,10 +484,12 @@ Launch layout editor launches the FancyZones layout editor application + Set and manage your layouts launches the FancyZones layout editor application @@ -715,9 +723,11 @@ Enable Image Resizer do not loc the Product name. Do you want this feature on / off + Configurations @@ -736,10 +746,12 @@ Unit + Image Resizer @@ -912,9 +924,11 @@ Last checked: + Administrator mode @@ -1012,9 +1026,11 @@ Made with 💗 by Microsoft and the PowerToys community. Example: %1 (%2) + Dark Dark refers to color, not weight @@ -1118,12 +1134,14 @@ Made with 💗 by Microsoft and the PowerToys community. Small The size of the image + Windows key +    or  Do not loc the icons (hex numbers) @@ -1175,9 +1193,11 @@ Made with 💗 by Microsoft and the PowerToys community. Show results on queries without direct activation command + Additional options @@ -1534,9 +1554,11 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex Pixels + No Label of a cancel button @@ -1557,12 +1579,14 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex Excluded apps + More options @@ -1645,9 +1669,11 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex Search this list + Attribution diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/ImageResizerPage.xaml.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/ImageResizerPage.xaml.cs index f790cf9e8..3975a5079 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/ImageResizerPage.xaml.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/ImageResizerPage.xaml.cs @@ -23,8 +23,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views { InitializeComponent(); var settingsUtils = new SettingsUtils(); - //TODO(stefan) - //var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView(); + var resourceLoader = ResourceLoader.GetForViewIndependentUse(); Func loader = (string name) => { //return resourceLoader.GetString(name); @@ -42,7 +41,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views if (deleteRowButton != null) { ImageSize x = (ImageSize)deleteRowButton.DataContext; - ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView(); + ResourceLoader resourceLoader = ResourceLoader.GetForViewIndependentUse(); ContentDialog dialog = new ContentDialog(); dialog.XamlRoot = RootPage.XamlRoot; @@ -73,7 +72,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views { try { - ViewModel.AddRow(ResourceLoader.GetForCurrentView().GetString("ImageResizer_DefaultSize_NewSizePrefix")); + ViewModel.AddRow(ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_DefaultSize_NewSizePrefix")); } catch (Exception ex) { @@ -87,8 +86,8 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views if (ViewModel.IsListViewFocusRequested) { // Set focus to the last item in the ListView - int size = ImagesSizesListView.Items.Count; - ((ListViewItem)ImagesSizesListView.ContainerFromIndex(size - 1)).Focus(FocusState.Programmatic); + //int size = ImagesSizesListView.Items.Count; + //((ListViewItem)ImagesSizesListView.ContainerFromIndex(size - 1)).Focus(FocusState.Programmatic); // Reset the focus requested flag ViewModel.IsListViewFocusRequested = false; diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/KeyboardManagerPage.xaml.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/KeyboardManagerPage.xaml.cs index ebd8ef05c..774843d1a 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/KeyboardManagerPage.xaml.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/KeyboardManagerPage.xaml.cs @@ -23,14 +23,15 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views { private const string PowerToyName = "Keyboard Manager"; - private readonly CoreDispatcher dispatcher; + // TODO(stefan) bring this back + //private readonly CoreDispatcher dispatcher; private readonly IFileSystemWatcher watcher; public KeyboardManagerViewModel ViewModel { get; } public KeyboardManagerPage() { - dispatcher = Window.Current.Dispatcher; + //dispatcher = Window.Current.Dispatcher; var settingsUtils = new SettingsUtils(); ViewModel = new KeyboardManagerViewModel(settingsUtils, SettingsRepository.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, FilterRemapKeysList); @@ -50,18 +51,18 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views // Todo: Handle duplicate events either by somehow suppress them or re-read the configuration everytime since we will be updating the UI only if something is changed. if (ViewModel.LoadProfile()) { - await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => + /*await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { ViewModel.NotifyFileChanged(); - }); + });*/ } } private static void CombineRemappings(List remapKeysList, uint leftKey, uint rightKey, uint combinedKey) { // Using InvariantCulture for keys as they are internally represented as numerical values - KeysDataModel firstRemap = remapKeysList.Find(x => uint.Parse(x.OriginalKeys, CultureInfo.InvariantCulture) == leftKey); - KeysDataModel secondRemap = remapKeysList.Find(x => uint.Parse(x.OriginalKeys, CultureInfo.InvariantCulture) == rightKey); + KeysDataModel firstRemap = remapKeysList?.Find(x => uint.Parse(x.OriginalKeys, CultureInfo.InvariantCulture) == leftKey); + KeysDataModel secondRemap = remapKeysList?.Find(x => uint.Parse(x.OriginalKeys, CultureInfo.InvariantCulture) == rightKey); if (firstRemap != null && secondRemap != null) { if (firstRemap.NewRemapKeys == secondRemap.NewRemapKeys) diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/PowerLauncherPage.xaml.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/PowerLauncherPage.xaml.cs index 344b98a8a..fbee03b68 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/PowerLauncherPage.xaml.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/PowerLauncherPage.xaml.cs @@ -9,6 +9,7 @@ using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Utilities; using Microsoft.PowerToys.Settings.UI.Library.ViewModels; using Microsoft.UI.Xaml.Controls; +using Windows.ApplicationModel.Resources; // TODO(stefan) using WindowsUI = Windows.UI; @@ -52,8 +53,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views } }); - // TODO(stefan) -/* var loader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView(); + var loader = ResourceLoader.GetForViewIndependentUse(); searchResultPreferencesOptions = new ObservableCollection>(); searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_AlphabeticalOrder"), "alphabetical_order")); @@ -64,7 +64,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ApplicationName"), "application_name")); searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_StringInApplication"), "string_in_application")); searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ExecutableName"), "executable_name")); -*/ } + } private void OpenColorsSettings_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/ShellPage.xaml.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/ShellPage.xaml.cs index 4e799b359..530fbd0d2 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/ShellPage.xaml.cs +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI.WinUI3/Views/ShellPage.xaml.cs @@ -14,6 +14,7 @@ using Microsoft.UI.Xaml.Controls; // TODO(stefan) using WSL = Windows.System.Launcher; +using Windows.ApplicationModel.Resources; namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views { @@ -186,14 +187,13 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views if (AutomationPeer.ListenerExists(AutomationEvents.MenuOpened)) { - // TODO(stefan) -/* var loader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView(); + var loader = ResourceLoader.GetForViewIndependentUse(); peer.RaiseNotificationEvent( AutomationNotificationKind.ActionCompleted, AutomationNotificationProcessing.ImportantMostRecent, loader.GetString("Shell_NavigationMenu_Announce_Open"), "navigationMenuPaneOpened"); -*/ } + } } [SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "Params are required for event handler signature requirements.")] @@ -214,13 +214,13 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views if (AutomationPeer.ListenerExists(AutomationEvents.MenuClosed)) { // TODO(stefan) - /* var loader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView(); + var loader = ResourceLoader.GetForViewIndependentUse(); peer.RaiseNotificationEvent( AutomationNotificationKind.ActionCompleted, AutomationNotificationProcessing.ImportantMostRecent, loader.GetString("Shell_NavigationMenu_Announce_Collapse"), "navigationMenuPaneClosed"); - */} + } } private void OOBEItem_Tapped(object sender, Microsoft.UI.Xaml.Input.TappedRoutedEventArgs e)