Various fixes

This commit is contained in:
Stefan Markovic 2021-11-19 11:01:08 +01:00
parent 2f698aae4c
commit b57b40bf2f
15 changed files with 105 additions and 158 deletions

View file

@ -71,17 +71,12 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
try
{
// 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)

View file

@ -2,13 +2,11 @@
using System.Globalization;
using Microsoft.PowerToys.Settings.UI.Library;
// TODO(stefan)
using WindowsUI = Windows.UI;
using interop;
using System;
using System.Diagnostics;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.WinUI3.Views;
using Windows.UI.ViewManagement;
using System.Diagnostics;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
@ -66,7 +64,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3
private MainWindow m_window;
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
{
m_window = new MainWindow();
m_window.ExtendsContentIntoTitleBar = true;
@ -74,6 +72,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3
m_window.Activate();
var cmdArgs = Environment.GetCommandLineArgs();
if (cmdArgs != null && cmdArgs.Length >= RequiredArgumentsQty)
{
_ = int.TryParse(cmdArgs[(int)Arguments.PTPid], out int powerToysPID);
@ -100,9 +99,9 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3
case "FileExplorer": StartupPage = typeof(Microsoft.PowerToys.Settings.UI.WinUI3.Views.PowerPreviewPage); break;
case "ShortcutGuide": StartupPage = typeof(Microsoft.PowerToys.Settings.UI.WinUI3.Views.ShortcutGuidePage); break;
case "VideoConference": StartupPage = typeof(Microsoft.PowerToys.Settings.UI.WinUI3.Views.VideoConferencePage); break;
default: break;// TODO(stefan): This crashes Debug.Assert(false, "Unexpected SettingsWindow argument value"); break;
default: Debug.Assert(false, "Unexpected SettingsWindow argument value"); break;
}
// m_window.Asd().Text = StartupPage.ToString() + " " + cmdArgs[(int)Arguments.SettingsWindow];
m_window.NavigateToSection(StartupPage);
}
RunnerHelper.WaitForPowerToysRunner(PowerToysPID, () =>
@ -116,16 +115,17 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3
{
m_window.DispatcherQueue.TryEnqueue(() =>
{
// TODO(stefan): not sure if this is correct
IPCMessageReceivedCallback(message);
});
}
});
ipcmanager.Start();
// TODO(stefan)
//app.Run();
}
else
{
// TODO(stefan) MessageBox not available
/* MessageBox.Show(
"The application cannot be run as a standalone process. Please start the application through the runner.",
"Forbidden",
@ -141,8 +141,8 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3
public static bool IsDarkTheme()
{
var selectedTheme = SettingsRepository<GeneralSettings>.GetInstance(settingsUtils).SettingsConfig.Theme.ToUpper(CultureInfo.InvariantCulture);
var defaultTheme = new WindowsUI.ViewManagement.UISettings();
var uiTheme = defaultTheme.GetColorValue(WindowsUI.ViewManagement.UIColorType.Background).ToString(System.Globalization.CultureInfo.InvariantCulture);
var defaultTheme = new UISettings();
var uiTheme = defaultTheme.GetColorValue(UIColorType.Background).ToString(System.Globalization.CultureInfo.InvariantCulture);
return selectedTheme == "DARK" || (selectedTheme == "SYSTEM" && uiTheme == "#FF000000");
}

View file

@ -13,7 +13,9 @@
d:DesignWidth="400">
<Grid>
<!--TODO(stefan)<muxc:DropDownButton Padding="4,4,8,4" AutomationProperties.FullDescription="{x:Bind clr:ColorHelper.ToDisplayName(SelectedColor), Mode=OneWay }">-->
<!--TODO(stefan) ColorHelper.ToDisplayName() not available in WinUI3
<muxc:DropDownButton Padding="4,4,8,4" AutomationProperties.FullDescription="{x:Bind clr:ColorHelper.ToDisplayName(SelectedColor), Mode=OneWay }">
-->
<muxc:DropDownButton Padding="4,4,8,4">
<Border x:Name="ColorPreviewBorder"
Width="48"

View file

@ -6,14 +6,11 @@ using System;
using Microsoft.PowerToys.Settings.UI.WinUI3.Helpers;
using Microsoft.PowerToys.Settings.UI.Library;
using Windows.ApplicationModel.Resources;
using Windows.UI.Core;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Automation;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
// TODO(stefan) Microsoft namespace is added to the front for some reason :S
using WindowsSystem = Windows.System;
using Windows.System;
namespace Microsoft.PowerToys.Settings.UI.WinUI3.Controls
{
@ -119,29 +116,29 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Controls
private void KeyEventHandler(int key, bool matchValue, int matchValueCode)
{
switch ((WindowsSystem.VirtualKey)key)
switch ((VirtualKey)key)
{
case WindowsSystem.VirtualKey.LeftWindows:
case WindowsSystem.VirtualKey.RightWindows:
case VirtualKey.LeftWindows:
case VirtualKey.RightWindows:
internalSettings.Win = matchValue;
break;
case WindowsSystem.VirtualKey.Control:
case WindowsSystem.VirtualKey.LeftControl:
case WindowsSystem.VirtualKey.RightControl:
case VirtualKey.Control:
case VirtualKey.LeftControl:
case VirtualKey.RightControl:
internalSettings.Ctrl = matchValue;
break;
case WindowsSystem.VirtualKey.Menu:
case WindowsSystem.VirtualKey.LeftMenu:
case WindowsSystem.VirtualKey.RightMenu:
case VirtualKey.Menu:
case VirtualKey.LeftMenu:
case VirtualKey.RightMenu:
internalSettings.Alt = matchValue;
break;
case WindowsSystem.VirtualKey.Shift:
case WindowsSystem.VirtualKey.LeftShift:
case WindowsSystem.VirtualKey.RightShift:
case VirtualKey.Shift:
case VirtualKey.LeftShift:
case VirtualKey.RightShift:
_shiftToggled = true;
internalSettings.Shift = matchValue;
break;
case WindowsSystem.VirtualKey.Escape:
case VirtualKey.Escape:
internalSettings = new HotkeySettings();
shortcutDialog.IsPrimaryButtonEnabled = false;
return;
@ -184,7 +181,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Controls
}
// If the current key press is tab, based on the other keys ignore the key press so as to shift focus out of the hotkey control.
if ((WindowsSystem.VirtualKey)key == WindowsSystem.VirtualKey.Tab)
if ((VirtualKey)key == VirtualKey.Tab)
{
// Shift was not pressed while entering and Shift is not pressed while leaving the hotkey control, treat it as a normal tab key press.
if (!internalSettings.Shift && !_shiftKeyDownOnEntering && !internalSettings.Win && !internalSettings.Alt && !internalSettings.Ctrl)
@ -198,7 +195,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Controls
// This is to reset the shift key press within the control as it was not used within the control but rather was used to leave the hotkey.
internalSettings.Shift = false;
SendSingleKeyboardInput((short)WindowsSystem.VirtualKey.Shift, (uint)NativeKeyboardHelper.KeyEventF.KeyDown);
SendSingleKeyboardInput((short)VirtualKey.Shift, (uint)NativeKeyboardHelper.KeyEventF.KeyDown);
return false;
}
@ -224,7 +221,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Controls
// The system still has shift in the key pressed status, therefore pass a Shift KeyUp message to the system, to release the shift key, therefore simulating only the Tab key press.
else if (!internalSettings.Shift && _shiftKeyDownOnEntering && _shiftToggled && !internalSettings.Win && !internalSettings.Alt && !internalSettings.Ctrl)
{
SendSingleKeyboardInput((short)WindowsSystem.VirtualKey.Shift, (uint)NativeKeyboardHelper.KeyEventF.KeyUp);
SendSingleKeyboardInput((short)VirtualKey.Shift, (uint)NativeKeyboardHelper.KeyEventF.KeyUp);
return false;
}
@ -239,50 +236,47 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Controls
return true;
}
private async void Hotkey_KeyDown(int key)
private void Hotkey_KeyDown(int key)
{
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
KeyEventHandler(key, true, key);
c.Keys = internalSettings.GetKeysList();
if (internalSettings.GetKeysList().Count == 0)
{
KeyEventHandler(key, true, key);
// Empty, disable save button
shortcutDialog.IsPrimaryButtonEnabled = false;
}
else if (internalSettings.GetKeysList().Count == 1)
{
// 1 key, disable save button
shortcutDialog.IsPrimaryButtonEnabled = false;
c.Keys = internalSettings.GetKeysList();
if (internalSettings.GetKeysList().Count == 0)
// Check if the one key is a hotkey
if (internalSettings.Shift || internalSettings.Win || internalSettings.Alt || internalSettings.Ctrl)
{
// Empty, disable save button
shortcutDialog.IsPrimaryButtonEnabled = false;
c.IsError = false;
}
else if (internalSettings.GetKeysList().Count == 1)
else
{
// 1 key, disable save button
shortcutDialog.IsPrimaryButtonEnabled = false;
// Check if the one key is a hotkey
if (internalSettings.Shift || internalSettings.Win || internalSettings.Alt || internalSettings.Ctrl)
{
c.IsError = false;
}
else
{
c.IsError = true;
}
c.IsError = true;
}
}
// Tab and Shift+Tab are accessible keys and should not be displayed in the hotkey control.
if (internalSettings.Code > 0 && !internalSettings.IsAccessibleShortcut())
// Tab and Shift+Tab are accessible keys and should not be displayed in the hotkey control.
if (internalSettings.Code > 0 && !internalSettings.IsAccessibleShortcut())
{
lastValidSettings = internalSettings.Clone();
if (!ComboIsValid(lastValidSettings))
{
lastValidSettings = internalSettings.Clone();
if (!ComboIsValid(lastValidSettings))
{
DisableKeys();
}
else
{
EnableKeys();
}
DisableKeys();
}
});
else
{
EnableKeys();
}
}
}
private void EnableKeys()
@ -301,12 +295,9 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Controls
// WarningLabel.Style = (Style)App.Current.Resources["SecondaryWarningTextStyle"];
}
private async void Hotkey_KeyUp(int key)
private void Hotkey_KeyUp(int key)
{
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
KeyEventHandler(key, false, 0);
});
KeyEventHandler(key, false, 0);
}
private bool Hotkey_IsActive()
@ -332,7 +323,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Controls
_shiftToggled = false;
// To keep track of the shift key, whether it was pressed on entering.
if ((NativeMethods.GetAsyncKeyState((int)WindowsSystem.VirtualKey.Shift) & 0x8000) != 0)
if ((NativeMethods.GetAsyncKeyState((int)VirtualKey.Shift) & 0x8000) != 0)
{
_shiftKeyDownOnEntering = true;
}

View file

@ -69,9 +69,11 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!--TODO(stefan)<muxc:InfoBadge AutomationProperties.AccessibilityView="Raw"
<!--TODO(stefan) InfoBadge not available
<muxc:InfoBadge AutomationProperties.AccessibilityView="Raw"
Margin="2,0,12,0"
Style="{StaticResource CriticalIconInfoBadgeStyle}" />-->
Style="{StaticResource CriticalIconInfoBadgeStyle}" />
-->

View file

@ -3,6 +3,8 @@ using Microsoft.PowerToys.Settings.UI.WinUI3.Views;
using Microsoft.UI.Xaml;
using System;
using Windows.Data.Json;
using Windows.ApplicationModel.Resources;
using Microsoft.UI.Xaml.Controls;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

View file

@ -9,7 +9,7 @@
<RuntimeIdentifiers>win10-x64;</RuntimeIdentifiers>
<PublishProfile>win10-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
<EnablePreviewMsixTooling>false</EnablePreviewMsixTooling>
<WindowsPackageType>None</WindowsPackageType>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>

View file

@ -8,7 +8,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Loaded="UserControl_Loaded">
<!--TODO(stefan)winui:BackdropMaterial.ApplyToRootOrPageBackground="True"-->
<!--TODO(stefan) Bring back Should be available in v1.1
winui:BackdropMaterial.ApplyToRootOrPageBackground="True"-->
<UserControl.Resources>
<DataTemplate x:Key="NavigationViewMenuItem" x:DataType="localModels:OobePowerToysModule">

View file

@ -199,11 +199,9 @@
<data name="VideoConference_Shortcuts.Header" xml:space="preserve">
<value>Shortcuts</value>
</data>
<!--
<data name="VideoConference_CameraOverlayImageAlt.AutomationProperties.Name" xml:space="preserve">
<data name="VideoConference_CameraOverlayImageAlt.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Camera overlay image preview</value>
</data>
-->
<data name="VideoConference_CameraOverlayImageBrowse.Content" xml:space="preserve">
<value>Browse</value>
</data>
@ -285,12 +283,10 @@
<value>Remap a key</value>
<comment>Keyboard Manager remap keyboard button content</comment>
</data>
<!--
<data name="KeyboardManager_RemapKeyboardButton_Accessible.AutomationProperties.Name" xml:space="preserve">
<data name="KeyboardManager_RemapKeyboardButton_Accessible.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Remap a key</value>
<comment>Keyboard Manager remap keyboard button content</comment>
</data>
-->
<data name="KeyboardManager_Keys.Header" xml:space="preserve">
<value>Keys</value>
<comment>Keyboard Manager remap keyboard header</comment>
@ -299,12 +295,10 @@
<value>Remap a shortcut</value>
<comment>Keyboard Manager remap shortcuts button</comment>
</data>
<!--
<data name="KeyboardManager_RemapShortcutsButton_Accessible.AutomationProperties.Name" xml:space="preserve">
<data name="KeyboardManager_RemapShortcutsButton_Accessible.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Remap a shortcut</value>
<comment>Keyboard Manager remap shortcuts button</comment>
</data>
-->
<data name="KeyboardManager_Shortcuts.Header" xml:space="preserve">
<value>Shortcuts</value>
<comment>Keyboard Manager remap keyboard header</comment>
@ -315,14 +309,12 @@
<data name="Shortcut.Header" xml:space="preserve">
<value>Shortcut</value>
</data>
<!--
<data name="RemapKeysList.AutomationProperties.Name" xml:space="preserve">
<data name="RemapKeysList.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Current Key Remappings</value>
</data>
<data name="RemapShortcutsList.AutomationProperties.Name" xml:space="preserve">
<data name="RemapShortcutsList.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Current Shortcut Remappings</value>
</data>
-->
<data name="KeyboardManager_RemappedKeysListItem.AutomationProperties.Name" xml:space="preserve">
<value>Key Remapping</value>
<comment>key as in keyboard key</comment>
@ -486,12 +478,10 @@
<value>Launch layout editor</value>
<comment>launches the FancyZones layout editor application</comment>
</data>
<!--
<data name="FancyZones_LaunchEditorButton_Accessible.AutomationProperties.Name" xml:space="preserve">
<data name="FancyZones_LaunchEditorButton_Accessible.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Launch layout editor</value>
<comment>launches the FancyZones layout editor application</comment>
</data>
-->
<data name="FancyZones_LaunchEditorButtonControl.Description" xml:space="preserve">
<value>Set and manage your layouts</value>
<comment>launches the FancyZones layout editor application</comment>
@ -725,11 +715,9 @@
<value>Enable Image Resizer</value>
<comment>do not loc the Product name. Do you want this feature on / off</comment>
</data>
<!--
<data name="ImagesSizesListView.AutomationProperties.Name" xml:space="preserve">
<data name="ImagesSizesListView.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Image Size</value>
</data>
-->
<data name="ImageResizer_Configurations.AutomationProperties.Name" xml:space="preserve">
<value>Configurations</value>
</data>
@ -748,12 +736,10 @@
<data name="ImageResizer_Size.Header" xml:space="preserve">
<value>Unit</value>
</data>
<!--
<data name="RemoveButton.AutomationProperties.Name" xml:space="preserve">
<data name="RemoveButton.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Remove</value>
<comment>Removes a user defined setting group for Image Resizer</comment>
</data>
-->
<data name="ImageResizer_Image.AutomationProperties.Name" xml:space="preserve">
<value>Image Resizer</value>
</data>
@ -926,11 +912,9 @@
<data name="General_VersionLastChecked.Text" xml:space="preserve">
<value>Last checked: </value>
</data>
<!--
<data name="General_Version.AutomationProperties.Name" xml:space="preserve">
<data name="General_Version.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Version</value>
</data>
-->
<data name="Admin_mode.Header" xml:space="preserve">
<value>Administrator mode</value>
</data>
@ -1028,11 +1012,9 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<data name="ImageResizer_FilenameFormatPlaceholder.PlaceholderText" xml:space="preserve">
<value>Example: %1 (%2)</value>
</data>
<!--
<data name="ImageResizer_FilenameParameters.AutomationProperties.Name" xml:space="preserve">
<data name="ImageResizer_FilenameParameters.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Filename parameters</value>
</data>
-->
<data name="Radio_Theme_Dark.Content" xml:space="preserve">
<value>Dark</value>
<comment>Dark refers to color, not weight</comment>
@ -1136,14 +1118,12 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<value>Small</value>
<comment>The size of the image</comment>
</data>
<!--
<data name="FancyZones_MoveWindowBasedOnRelativePosition_Accessible.AutomationProperties.Name" xml:space="preserve">
<data name="FancyZones_MoveWindowBasedOnRelativePosition_Accessible.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Windows key + Up, down, left or right arrow key to move windows based on relative position</value>
</data>
<data name="FancyZones_MoveWindowLeftRightBasedOnZoneIndex_Accessible.AutomationProperties.Name" xml:space="preserve">
<data name="FancyZones_MoveWindowLeftRightBasedOnZoneIndex_Accessible.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Windows key + Left or right arrow keys to move windows based on zone index</value>
</data>
-->
<data name="FancyZones_MoveWindowBasedOnRelativePosition_Description.Text" xml:space="preserve">
<value>Windows key +    or </value>
<comment>Do not loc the icons (hex numbers)</comment>
@ -1195,11 +1175,9 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<data name="PowerLauncher_IncludeInGlobalResultDescription.Text" xml:space="preserve">
<value>Show results on queries without direct activation command</value>
</data>
<!--
<data name="PowerLauncher_EnablePluginToggle.AutomationProperties.Name" xml:space="preserve">
<data name="PowerLauncher_EnablePluginToggle.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Enable plugin</value>
</data>
-->
<data name="Run_AdditionalOptions.Text" xml:space="preserve">
<value>Additional options</value>
</data>
@ -1556,11 +1534,9 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
<data name="ImageResizer_Unit_Pixel" xml:space="preserve">
<value>Pixels</value>
</data>
<!--
<data name="EditButton.AutomationProperties.Name" xml:space="preserve">
<data name="EditButton.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Edit</value>
</data>
-->
<data name="No" xml:space="preserve">
<value>No</value>
<comment>Label of a cancel button</comment>
@ -1581,14 +1557,12 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
<data name="ExcludedApps.Header" xml:space="preserve">
<value>Excluded apps</value>
</data>
<!--
<data name="Enable_ColorFormat.AutomationProperties.Name" xml:space="preserve">
<data name="Enable_ColorFormat.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Enable colorformat</value>
</data>
<data name="More_Options_Button.AutomationProperties.Name" xml:space="preserve">
<data name="More_Options_Button.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>More options</value>
</data>
-->
<data name="More_Options_ButtonTooltip.Text" xml:space="preserve">
<value>More options</value>
</data>
@ -1671,11 +1645,9 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
<data name="PowerLauncher_SearchList.PlaceholderText" xml:space="preserve">
<value>Search this list</value>
</data>
<!--
<data name="PowerLauncher_SearchList.AutomationProperties.Name" xml:space="preserve">
<data name="PowerLauncher_SearchList.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Search this list</value>
</data>
-->
<data name="Awake.SecondaryLinksHeader" xml:space="preserve">
<value>Attribution</value>
</data>

View file

@ -5,7 +5,6 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
@ -26,8 +25,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views
var resourceLoader = ResourceLoader.GetForViewIndependentUse();
Func<string, string> loader = (string name) =>
{
//return resourceLoader.GetString(name);
return "TODO(stefan)";
return resourceLoader.GetString(name);
};
ViewModel = new ImageResizerViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, loader);

View file

@ -2,7 +2,6 @@
// 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;
using System.Collections.Generic;
using System.Globalization;
using System.IO.Abstractions;
@ -10,9 +9,8 @@ using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
using Windows.System;
using Windows.UI.Core;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System.Threading.Tasks;
namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views
{
@ -23,16 +21,12 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views
{
private const string PowerToyName = "Keyboard Manager";
// TODO(stefan) bring this back
//private readonly CoreDispatcher dispatcher;
private readonly IFileSystemWatcher watcher;
public KeyboardManagerViewModel ViewModel { get; }
public KeyboardManagerPage()
{
//dispatcher = Window.Current.Dispatcher;
var settingsUtils = new SettingsUtils();
ViewModel = new KeyboardManagerViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, FilterRemapKeysList);
@ -45,16 +39,13 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views
DataContext = ViewModel;
}
private async void OnConfigFileUpdate()
private void OnConfigFileUpdate()
{
// Note: FileSystemWatcher raise notification multiple times for single update operation.
// 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, () =>
{
ViewModel.NotifyFileChanged();
});*/
ViewModel.NotifyFileChanged();
}
}

View file

@ -202,10 +202,11 @@
<controls:Setting.ActionContent>
<StackPanel Orientation="Horizontal" Spacing="16">
<!-- TODO(stefan)
<!-- TODO(stefan) InfoBadge not available
<muxc:InfoBadge AutomationProperties.AccessibilityView="Raw"
Visibility="{x:Bind ShowNotAccessibleWarning}"
Style="{StaticResource CriticalIconInfoBadgeStyle}" />-->
Style="{StaticResource CriticalIconInfoBadgeStyle}" />
-->
<ToggleSwitch x:Uid="PowerLauncher_EnablePluginToggle"
IsOn="{x:Bind Path=Disabled, Converter={StaticResource BoolNegationConverter}, Mode=TwoWay}"/>
</StackPanel>

View file

@ -11,9 +11,6 @@ using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
using Microsoft.UI.Xaml.Controls;
using Windows.ApplicationModel.Resources;
// TODO(stefan)
using WindowsUI = Windows.UI;
namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views
{
public sealed partial class PowerLauncherPage : Page
@ -30,6 +27,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views
PowerLauncherSettings settings = settingsUtils.GetSettingsOrDefault<PowerLauncherSettings>(PowerLauncherSettings.ModuleName);
ViewModel = new PowerLauncherViewModel(settings, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, App.IsDarkTheme);
DataContext = ViewModel;
_ = Helper.GetFileWatcher(PowerLauncherSettings.ModuleName, "settings.json", () =>
{
PowerLauncherSettings powerLauncherSettings = null;
@ -44,12 +42,8 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views
if (powerLauncherSettings != null && !ViewModel.IsUpToDate(powerLauncherSettings))
{
_ = Dispatcher.RunAsync(WindowsUI.Core.CoreDispatcherPriority.Normal, () =>
{
DataContext = ViewModel = new PowerLauncherViewModel(powerLauncherSettings, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, App.IsDarkTheme);
// TODO(stefan)
// this.Bindings.Update();
});
DataContext = ViewModel = new PowerLauncherViewModel(powerLauncherSettings, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, App.IsDarkTheme);
this.Bindings.Update();
}
});

View file

@ -10,7 +10,8 @@
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
xmlns:i="using:Microsoft.Xaml.Interactivity"
mc:Ignorable="d">
<!--TODO(stefan)BackdropMaterial.ApplyToRootOrPageBackground="True"-->
<!--TODO(stefan): Bring back Should be available in v1.1
BackdropMaterial.ApplyToRootOrPageBackground="True"-->
<i:Interaction.Behaviors>
<ic:EventTriggerBehavior EventName="Loaded">

View file

@ -7,15 +7,13 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.PowerToys.Settings.UI.WinUI3.Services;
using Microsoft.PowerToys.Settings.UI.WinUI3.ViewModels;
using Windows.ApplicationModel.Resources;
using Windows.Data.Json;
using Windows.System;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Automation.Peers;
using Microsoft.UI.Xaml.Controls;
// TODO(stefan)
using WSL = Windows.System.Launcher;
using Windows.ApplicationModel.Resources;
namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views
{
/// <summary>
@ -213,7 +211,6 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views
if (AutomationPeer.ListenerExists(AutomationEvents.MenuClosed))
{
// TODO(stefan)
var loader = ResourceLoader.GetForViewIndependentUse();
peer.RaiseNotificationEvent(
AutomationNotificationKind.ActionCompleted,
@ -230,7 +227,7 @@ namespace Microsoft.PowerToys.Settings.UI.WinUI3.Views
private async void FeedbackItem_Tapped(object sender, Microsoft.UI.Xaml.Input.TappedRoutedEventArgs e)
{
await WSL.LaunchUriAsync(new Uri("https://aka.ms/powerToysGiveFeedback"));
await Launcher.LaunchUriAsync(new Uri("https://aka.ms/powerToysGiveFeedback"));
}
}
}