mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
[AOT] clean up AOT issue in Settings.UI (#36559)
* Rename source generation context file * fix build issue * fix path bug --------- Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
This commit is contained in:
48
src/settings-ui/Settings.UI/Helpers/ActionMessage.cs
Normal file
48
src/settings-ui/Settings.UI/Helpers/ActionMessage.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
public sealed class ActionMessage
|
||||
{
|
||||
[JsonPropertyName("action")]
|
||||
public SettingsAction Action { get; set; }
|
||||
|
||||
public static ActionMessage Create(string actionName)
|
||||
{
|
||||
return new ActionMessage
|
||||
{
|
||||
Action = new SettingsAction
|
||||
{
|
||||
PublishedDate = new SettingsGeneral
|
||||
{
|
||||
ActionName = actionName,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Those are just a define for one simple struct")]
|
||||
public sealed class SettingsAction
|
||||
{
|
||||
[JsonPropertyName("general")]
|
||||
public SettingsGeneral PublishedDate { get; set; }
|
||||
}
|
||||
|
||||
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Those are just a define for one simple struct")]
|
||||
public sealed class SettingsGeneral
|
||||
{
|
||||
[JsonPropertyName("action_name")]
|
||||
public string ActionName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ using System.Windows.Input;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
internal sealed class AsyncCommand : ICommand
|
||||
internal sealed partial class AsyncCommand : ICommand
|
||||
{
|
||||
private readonly Func<Task> _execute;
|
||||
private readonly Func<bool> _canExecute;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
}
|
||||
|
||||
#pragma warning disable SA1402 // File may only contain a single type
|
||||
public class IndexedObservableCollection<T> : ObservableCollection<IndexedItem<T>>
|
||||
public partial class IndexedObservableCollection<T> : ObservableCollection<IndexedItem<T>>
|
||||
#pragma warning restore SA1402 // File may only contain a single type
|
||||
{
|
||||
public IndexedObservableCollection(IEnumerable<T> items)
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
|
||||
internal static int Size
|
||||
{
|
||||
get { return Marshal.SizeOf(typeof(INPUT)); }
|
||||
get { return Marshal.SizeOf<INPUT>(); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
29
src/settings-ui/Settings.UI/Helpers/PowerToysReleaseInfo.cs
Normal file
29
src/settings-ui/Settings.UI/Helpers/PowerToysReleaseInfo.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
// Contains information for a release. Used to deserialize release JSON info from GitHub.
|
||||
public sealed class PowerToysReleaseInfo
|
||||
{
|
||||
[JsonPropertyName("published_at")]
|
||||
public DateTimeOffset PublishedDate { get; set; }
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonPropertyName("tag_name")]
|
||||
public string TagName { get; set; }
|
||||
|
||||
[JsonPropertyName("body")]
|
||||
public string ReleaseNotes { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using System.Windows.Input;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
public class RelayCommand : ICommand
|
||||
public partial class RelayCommand : ICommand
|
||||
{
|
||||
private readonly Action _execute;
|
||||
private readonly Func<bool> _canExecute;
|
||||
@@ -33,7 +33,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "abstract T and abstract")]
|
||||
public class RelayCommand<T> : ICommand
|
||||
public partial class RelayCommand<T> : ICommand
|
||||
{
|
||||
private readonly Action<T> execute;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.Json;
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
@@ -20,9 +20,9 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
try
|
||||
{
|
||||
var json = File.ReadAllText(_placementPath);
|
||||
var placement = JsonSerializer.Deserialize<WINDOWPLACEMENT>(json);
|
||||
var placement = JsonSerializer.Deserialize<WINDOWPLACEMENT>(json, SourceGenerationContextContext.Default.WINDOWPLACEMENT);
|
||||
|
||||
placement.Length = Marshal.SizeOf(typeof(WINDOWPLACEMENT));
|
||||
placement.Length = Marshal.SizeOf<WINDOWPLACEMENT>();
|
||||
placement.Flags = 0;
|
||||
placement.ShowCmd = (placement.ShowCmd == NativeMethods.SW_SHOWMAXIMIZED) ? NativeMethods.SW_SHOWMAXIMIZED : NativeMethods.SW_SHOWNORMAL;
|
||||
return placement;
|
||||
@@ -40,7 +40,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
_ = NativeMethods.GetWindowPlacement(handle, out var placement);
|
||||
try
|
||||
{
|
||||
var json = JsonSerializer.Serialize(placement);
|
||||
var json = JsonSerializer.Serialize(placement, SourceGenerationContextContext.Default.WINDOWPLACEMENT);
|
||||
File.WriteAllText(_placementPath, json);
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
|
||||
[JsonSerializable(typeof(WINDOWPLACEMENT))]
|
||||
[JsonSerializable(typeof(AdvancedPasteSettings))]
|
||||
[JsonSerializable(typeof(Dictionary<string, List<string>>))]
|
||||
[JsonSerializable(typeof(AlwaysOnTopSettings))]
|
||||
[JsonSerializable(typeof(ColorPickerSettings))]
|
||||
[JsonSerializable(typeof(CropAndLockSettings))]
|
||||
[JsonSerializable(typeof(FileLocksmithSettings))]
|
||||
[JsonSerializable(typeof(MeasureToolSettings))]
|
||||
[JsonSerializable(typeof(MouseWithoutBordersSettings))]
|
||||
[JsonSerializable(typeof(NewPlusSettings))]
|
||||
[JsonSerializable(typeof(PeekSettings))]
|
||||
[JsonSerializable(typeof(PowerLauncherSettings))]
|
||||
[JsonSerializable(typeof(PowerOcrSettings))]
|
||||
[JsonSerializable(typeof(RegistryPreviewSettings))]
|
||||
[JsonSerializable(typeof(WorkspacesSettings))]
|
||||
[JsonSerializable(typeof(IList<PowerToysReleaseInfo>))]
|
||||
[JsonSerializable(typeof(ActionMessage))]
|
||||
public sealed partial class SourceGenerationContextContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
@@ -14,6 +14,7 @@ using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
using Microsoft.PowerToys.Settings.UI.Services;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
@@ -167,7 +168,7 @@ namespace Microsoft.PowerToys.Settings.UI
|
||||
|
||||
try
|
||||
{
|
||||
var requestedSettings = JsonSerializer.Deserialize<Dictionary<string, List<string>>>(File.ReadAllText(ipcFileName));
|
||||
var requestedSettings = JsonSerializer.Deserialize<Dictionary<string, List<string>>>(File.ReadAllText(ipcFileName), SourceGenerationContextContext.Default.DictionaryStringListString);
|
||||
File.WriteAllText(ipcFileName, GetSettingCommandLineCommand.Execute(requestedSettings));
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -20,6 +20,7 @@ using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
@@ -29,22 +30,6 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
public sealed partial class OobeWhatsNew : Page
|
||||
{
|
||||
// Contains information for a release. Used to deserialize release JSON info from GitHub.
|
||||
private sealed class PowerToysReleaseInfo
|
||||
{
|
||||
[JsonPropertyName("published_at")]
|
||||
public DateTimeOffset PublishedDate { get; set; }
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonPropertyName("tag_name")]
|
||||
public string TagName { get; set; }
|
||||
|
||||
[JsonPropertyName("body")]
|
||||
public string ReleaseNotes { get; set; }
|
||||
}
|
||||
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public bool ShowDataDiagnosticsInfoBar => GetShowDataDiagnosticsInfoBar();
|
||||
@@ -111,7 +96,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
// https://docs.github.com/rest/overview/resources-in-the-rest-api#user-agent-required
|
||||
getReleaseInfoClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "PowerToys");
|
||||
releaseNotesJSON = await getReleaseInfoClient.GetStringAsync("https://api.github.com/repos/microsoft/PowerToys/releases");
|
||||
IList<PowerToysReleaseInfo> releases = JsonSerializer.Deserialize<IList<PowerToysReleaseInfo>>(releaseNotesJSON);
|
||||
IList<PowerToysReleaseInfo> releases = JsonSerializer.Deserialize<IList<PowerToysReleaseInfo>>(releaseNotesJSON, SourceGenerationContextContext.Default.IListPowerToysReleaseInfo);
|
||||
|
||||
// Get the latest releases
|
||||
var latestReleases = releases.OrderByDescending(release => release.PublishedDate).Take(5);
|
||||
|
||||
@@ -18,12 +18,13 @@ using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
using Microsoft.Win32;
|
||||
using Windows.Security.Credentials;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class AdvancedPasteViewModel : Observable, IDisposable
|
||||
public partial class AdvancedPasteViewModel : Observable, IDisposable
|
||||
{
|
||||
private static readonly HashSet<string> WarnHotkeys = ["Ctrl + V", "Ctrl + Shift + V"];
|
||||
|
||||
@@ -387,7 +388,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
AdvancedPasteSettings.ModuleName,
|
||||
JsonSerializer.Serialize(_advancedPasteSettings)));
|
||||
JsonSerializer.Serialize(_advancedPasteSettings, SourceGenerationContextContext.Default.AdvancedPasteSettings)));
|
||||
}
|
||||
|
||||
public void RefreshEnabledState()
|
||||
|
||||
@@ -12,10 +12,11 @@ using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class AlwaysOnTopViewModel : Observable
|
||||
public partial class AlwaysOnTopViewModel : Observable
|
||||
{
|
||||
private ISettingsUtils SettingsUtils { get; set; }
|
||||
|
||||
@@ -131,7 +132,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
AlwaysOnTopSettings.ModuleName,
|
||||
JsonSerializer.Serialize(Settings)));
|
||||
JsonSerializer.Serialize(Settings, SourceGenerationContextContext.Default.AlwaysOnTopSettings)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class AwakeViewModel : Observable
|
||||
public partial class AwakeViewModel : Observable
|
||||
{
|
||||
public AwakeViewModel()
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class CmdNotFoundViewModel : Observable
|
||||
public partial class CmdNotFoundViewModel : Observable
|
||||
{
|
||||
public ButtonClickCommand CheckRequirementsEventHandler => new ButtonClickCommand(CheckCommandNotFoundRequirements);
|
||||
|
||||
@@ -39,10 +39,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
string codeBase = Assembly.GetExecutingAssembly().Location;
|
||||
UriBuilder uri = new UriBuilder(codeBase);
|
||||
string path = Uri.UnescapeDataString(uri.Path);
|
||||
return Path.GetDirectoryName(path);
|
||||
return Path.TrimEndingDirectorySeparator(AppContext.BaseDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,11 @@ using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class ColorPickerViewModel : Observable, IDisposable
|
||||
public partial class ColorPickerViewModel : Observable, IDisposable
|
||||
{
|
||||
private bool disposedValue;
|
||||
|
||||
@@ -362,7 +363,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
ColorPickerSettings.ModuleName,
|
||||
JsonSerializer.Serialize(_colorPickerSettings)));
|
||||
JsonSerializer.Serialize(_colorPickerSettings, SourceGenerationContextContext.Default.ColorPickerSettings)));
|
||||
}
|
||||
|
||||
public void RefreshEnabledState()
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Windows.Input;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels.Commands
|
||||
{
|
||||
public class ButtonClickCommand : ICommand
|
||||
public partial class ButtonClickCommand : ICommand
|
||||
{
|
||||
private readonly Action _execute;
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@ using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class CropAndLockViewModel : Observable
|
||||
public partial class CropAndLockViewModel : Observable
|
||||
{
|
||||
private ISettingsUtils SettingsUtils { get; set; }
|
||||
|
||||
@@ -122,7 +123,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
CropAndLockSettings.ModuleName,
|
||||
JsonSerializer.Serialize(Settings)));
|
||||
JsonSerializer.Serialize(Settings, SourceGenerationContextContext.Default.CropAndLockSettings)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,7 +154,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
CropAndLockSettings.ModuleName,
|
||||
JsonSerializer.Serialize(Settings)));
|
||||
JsonSerializer.Serialize(Settings, SourceGenerationContextContext.Default.CropAndLockSettings)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ using Windows.UI;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class DashboardListItem : INotifyPropertyChanged
|
||||
public partial class DashboardListItem : INotifyPropertyChanged
|
||||
{
|
||||
private bool _visible;
|
||||
private bool _isEnabled;
|
||||
|
||||
@@ -14,11 +14,11 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
#pragma warning disable SA1402 // File may only contain a single type
|
||||
#pragma warning disable SA1649 // File name should match first type name
|
||||
public class DashboardModuleTextItem : DashboardModuleItem
|
||||
public partial class DashboardModuleTextItem : DashboardModuleItem
|
||||
{
|
||||
}
|
||||
|
||||
public class DashboardModuleButtonItem : DashboardModuleItem
|
||||
public partial class DashboardModuleButtonItem : DashboardModuleItem
|
||||
{
|
||||
public string ButtonTitle { get; set; }
|
||||
|
||||
@@ -31,12 +31,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
public RoutedEventHandler ButtonClickHandler { get; set; }
|
||||
}
|
||||
|
||||
public class DashboardModuleShortcutItem : DashboardModuleItem
|
||||
public partial class DashboardModuleShortcutItem : DashboardModuleItem
|
||||
{
|
||||
public List<object> Shortcut { get; set; }
|
||||
}
|
||||
|
||||
public class DashboardModuleKBMItem : DashboardModuleItem
|
||||
public partial class DashboardModuleKBMItem : DashboardModuleItem
|
||||
{
|
||||
private List<KeysDataModel> _remapKeys = new List<KeysDataModel>();
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public class DashboardModuleItem : INotifyPropertyChanged
|
||||
public partial class DashboardModuleItem : INotifyPropertyChanged
|
||||
{
|
||||
public string Label { get; set; }
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class DashboardViewModel : Observable
|
||||
public partial class DashboardViewModel : Observable
|
||||
{
|
||||
private const string JsonFileType = ".json";
|
||||
private IFileSystemWatcher _watcher;
|
||||
@@ -55,7 +55,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
_allModules = new List<DashboardListItem>();
|
||||
|
||||
foreach (ModuleType moduleType in Enum.GetValues(typeof(ModuleType)))
|
||||
foreach (ModuleType moduleType in Enum.GetValues<ModuleType>())
|
||||
{
|
||||
AddDashboardListItem(moduleType);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ using Settings.UI.Library.Enumerations;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class EnvironmentVariablesViewModel : Observable
|
||||
public partial class EnvironmentVariablesViewModel : Observable
|
||||
{
|
||||
private bool _isElevated;
|
||||
private GpoRuleConfigured _enabledGpoRuleConfiguration;
|
||||
|
||||
@@ -13,7 +13,7 @@ using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class FancyZonesViewModel : Observable
|
||||
public partial class FancyZonesViewModel : Observable
|
||||
{
|
||||
private SettingsUtils SettingsUtils { get; set; }
|
||||
|
||||
|
||||
@@ -10,10 +10,11 @@ using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class FileLocksmithViewModel : Observable
|
||||
public partial class FileLocksmithViewModel : Observable
|
||||
{
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
@@ -134,7 +135,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
FileLocksmithSettings.ModuleName,
|
||||
JsonSerializer.Serialize(Settings)));
|
||||
JsonSerializer.Serialize(Settings, SourceGenerationContextContext.Default.FileLocksmithSettings)));
|
||||
}
|
||||
|
||||
private Func<string, int> SendConfigMSG { get; }
|
||||
|
||||
@@ -15,7 +15,7 @@ using Microsoft.Windows.ApplicationModel.Resources;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class AllAppsViewModel : Observable
|
||||
public partial class AllAppsViewModel : Observable
|
||||
{
|
||||
public ObservableCollection<FlyoutMenuItem> FlyoutMenuItems { get; set; }
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
resourceLoader = Helpers.ResourceLoaderInstance.ResourceLoader;
|
||||
FlyoutMenuItems = new ObservableCollection<FlyoutMenuItem>();
|
||||
|
||||
foreach (ModuleType moduleType in Enum.GetValues(typeof(ModuleType)))
|
||||
foreach (ModuleType moduleType in Enum.GetValues<ModuleType>())
|
||||
{
|
||||
AddFlyoutMenuItem(moduleType);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using ManagedCommon;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class FlyoutMenuItem : INotifyPropertyChanged
|
||||
public partial class FlyoutMenuItem : INotifyPropertyChanged
|
||||
{
|
||||
private bool _visible;
|
||||
private bool _isEnabled;
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Timers;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels.Flyout
|
||||
{
|
||||
public class FlyoutViewModel : IDisposable
|
||||
public partial class FlyoutViewModel : IDisposable
|
||||
{
|
||||
private Timer _hideTimer;
|
||||
private bool _disposed;
|
||||
|
||||
@@ -15,7 +15,7 @@ using Microsoft.Windows.ApplicationModel.Resources;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class LauncherViewModel : Observable
|
||||
public partial class LauncherViewModel : Observable
|
||||
{
|
||||
public bool IsUpdateAvailable { get; set; }
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.IO.Abstractions;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization.Metadata;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using global::PowerToys.GPOWrapper;
|
||||
@@ -22,11 +23,12 @@ using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class GeneralViewModel : Observable
|
||||
public partial class GeneralViewModel : Observable
|
||||
{
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
@@ -34,7 +36,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
public ButtonClickCommand CheckForUpdatesEventHandler { get; set; }
|
||||
|
||||
public object ResourceLoader { get; set; }
|
||||
public Windows.ApplicationModel.Resources.ResourceLoader ResourceLoader { get; set; }
|
||||
|
||||
private Action HideBackupAndRestoreMessageAreaAction { get; set; }
|
||||
|
||||
@@ -70,7 +72,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
private SettingsBackupAndRestoreUtils settingsBackupAndRestoreUtils = SettingsBackupAndRestoreUtils.Instance;
|
||||
|
||||
public GeneralViewModel(ISettingsRepository<GeneralSettings> settingsRepository, string runAsAdminText, string runAsUserText, bool isElevated, bool isAdmin, Func<string, int> ipcMSGCallBackFunc, Func<string, int> ipcMSGRestartAsAdminMSGCallBackFunc, Func<string, int> ipcMSGCheckForUpdatesCallBackFunc, string configFileSubfolder = "", Action dispatcherAction = null, Action hideBackupAndRestoreMessageAreaAction = null, Action<int> doBackupAndRestoreDryRun = null, Func<Task<string>> pickSingleFolderDialog = null, object resourceLoader = null)
|
||||
public GeneralViewModel(ISettingsRepository<GeneralSettings> settingsRepository, string runAsAdminText, string runAsUserText, bool isElevated, bool isAdmin, Func<string, int> ipcMSGCallBackFunc, Func<string, int> ipcMSGRestartAsAdminMSGCallBackFunc, Func<string, int> ipcMSGCheckForUpdatesCallBackFunc, string configFileSubfolder = "", Action dispatcherAction = null, Action hideBackupAndRestoreMessageAreaAction = null, Action<int> doBackupAndRestoreDryRun = null, Func<Task<string>> pickSingleFolderDialog = null, Windows.ApplicationModel.Resources.ResourceLoader resourceLoader = null)
|
||||
{
|
||||
CheckForUpdatesEventHandler = new ButtonClickCommand(CheckForUpdatesClick);
|
||||
RestartElevatedButtonEventHandler = new ButtonClickCommand(RestartElevated);
|
||||
@@ -1075,11 +1077,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
if (ResourceLoader != null)
|
||||
{
|
||||
var type = ResourceLoader.GetType();
|
||||
MethodInfo methodInfo = type.GetMethod("GetString");
|
||||
object classInstance = Activator.CreateInstance(type, null);
|
||||
object[] parametersArray = new object[] { resource };
|
||||
var result = (string)methodInfo.Invoke(ResourceLoader, parametersArray);
|
||||
var result = ResourceLoader.GetString(resource);
|
||||
if (string.IsNullOrEmpty(result))
|
||||
{
|
||||
return resource.ToUpperInvariant() + "!!!";
|
||||
@@ -1129,7 +1127,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
GeneralSettingsCustomAction customaction = new GeneralSettingsCustomAction(outsettings);
|
||||
|
||||
var dataToSend = customaction.ToString();
|
||||
dataToSend = JsonSerializer.Serialize(new { action = new { general = new { action_name = "restart_maintain_elevation" } } });
|
||||
dataToSend = JsonSerializer.Serialize(ActionMessage.Create("restart_maintain_elevation"), SourceGenerationContextContext.Default.ActionMessage);
|
||||
SendRestartAsAdminConfigMSG(dataToSend);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ using Settings.UI.Library.Enumerations;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class HostsViewModel : Observable
|
||||
public partial class HostsViewModel : Observable
|
||||
{
|
||||
private bool _isElevated;
|
||||
private GpoRuleConfigured _enabledGpoRuleConfiguration;
|
||||
|
||||
@@ -23,7 +23,7 @@ using Microsoft.Win32;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class KeyboardManagerViewModel : Observable
|
||||
public partial class KeyboardManagerViewModel : Observable
|
||||
{
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
|
||||
@@ -11,10 +11,11 @@ using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class MeasureToolViewModel : Observable
|
||||
public partial class MeasureToolViewModel : Observable
|
||||
{
|
||||
private ISettingsUtils SettingsUtils { get; set; }
|
||||
|
||||
@@ -213,7 +214,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
MeasureToolSettings.ModuleName,
|
||||
JsonSerializer.Serialize(Settings)));
|
||||
JsonSerializer.Serialize(Settings, SourceGenerationContextContext.Default.MeasureToolSettings)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
@@ -29,7 +30,7 @@ using Windows.ApplicationModel.DataTransfer;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class MouseWithoutBordersViewModel : Observable, IDisposable
|
||||
public partial class MouseWithoutBordersViewModel : Observable, IDisposable
|
||||
{
|
||||
// These should be in the same order as the ComboBoxItems in MouseWithoutBordersPage.xaml switch machine shortcut options
|
||||
private readonly int[] _switchBetweenMachineShortcutOptions =
|
||||
@@ -277,7 +278,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
private static VisualStudio.Threading.AsyncSemaphore _ipcSemaphore = new VisualStudio.Threading.AsyncSemaphore(1);
|
||||
|
||||
private sealed class SyncHelper : IDisposable
|
||||
private sealed partial class SyncHelper : IDisposable
|
||||
{
|
||||
public SyncHelper(NamedPipeClientStream stream)
|
||||
{
|
||||
@@ -1102,7 +1103,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
private IndexedObservableCollection<DeviceViewModel> machineMatrixString;
|
||||
|
||||
public class DeviceViewModel : Observable
|
||||
public partial class DeviceViewModel : Observable
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
@@ -1204,7 +1205,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
MouseWithoutBordersSettings.ModuleName,
|
||||
JsonSerializer.Serialize(Settings)));
|
||||
JsonSerializer.Serialize(Settings, SourceGenerationContextContext.Default.MouseWithoutBordersSettings)));
|
||||
}
|
||||
|
||||
public void NotifyUpdatedSettings()
|
||||
|
||||
@@ -12,12 +12,12 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using global::PowerToys.GPOWrapper;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
using Windows.ApplicationModel.VoiceCommands;
|
||||
using Windows.System;
|
||||
|
||||
@@ -25,7 +25,7 @@ using static Microsoft.PowerToys.Settings.UI.Helpers.ShellGetFolder;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class NewPlusViewModel : Observable
|
||||
public partial class NewPlusViewModel : Observable
|
||||
{
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
ModuleName,
|
||||
JsonSerializer.Serialize(Settings)));
|
||||
JsonSerializer.Serialize(Settings, SourceGenerationContextContext.Default.NewPlusSettings)));
|
||||
}
|
||||
|
||||
private Func<string, int> SendConfigMSG { get; }
|
||||
|
||||
@@ -10,11 +10,12 @@ using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
using Settings.UI.Library;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class PeekViewModel : Observable
|
||||
public partial class PeekViewModel : Observable
|
||||
{
|
||||
private bool _isEnabled;
|
||||
|
||||
@@ -224,7 +225,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
PeekSettings.ModuleName,
|
||||
JsonSerializer.Serialize(_peekSettings)));
|
||||
JsonSerializer.Serialize(_peekSettings, SourceGenerationContextContext.Default.PeekSettings)));
|
||||
}
|
||||
|
||||
private void SavePreviewSettings()
|
||||
|
||||
@@ -11,7 +11,7 @@ using Microsoft.PowerToys.Settings.UI.Library;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class PluginAdditionalOptionViewModel : INotifyPropertyChanged
|
||||
public partial class PluginAdditionalOptionViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private PluginAdditionalOption _additionalOption;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class PowerAccentViewModel : Observable
|
||||
public partial class PowerAccentViewModel : Observable
|
||||
{
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ using Microsoft.PowerToys.Settings.UI.Library;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class PowerLauncherPluginViewModel : INotifyPropertyChanged
|
||||
public partial class PowerLauncherPluginViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private readonly PowerLauncherPluginSettings settings;
|
||||
private readonly Func<bool> isDark;
|
||||
|
||||
@@ -17,10 +17,11 @@ using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class PowerLauncherViewModel : Observable
|
||||
public partial class PowerLauncherViewModel : Observable
|
||||
{
|
||||
private int _themeIndex;
|
||||
private int _monitorPositionIndex;
|
||||
@@ -74,7 +75,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
PowerLauncherSettings.ModuleName,
|
||||
JsonSerializer.Serialize(s)));
|
||||
JsonSerializer.Serialize(s, SourceGenerationContextContext.Default.PowerLauncherSettings)));
|
||||
};
|
||||
|
||||
switch (settings.Properties.Theme)
|
||||
@@ -103,7 +104,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
break;
|
||||
}
|
||||
|
||||
SearchPluginsCommand = new RelayCommand(SearchPlugins);
|
||||
SearchPluginsCommand = new Library.ViewModels.Commands.RelayCommand(SearchPlugins);
|
||||
}
|
||||
|
||||
private void InitializeEnabledValue()
|
||||
|
||||
@@ -14,12 +14,13 @@ using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
using Windows.Globalization;
|
||||
using Windows.Media.Ocr;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class PowerOcrViewModel : Observable, IDisposable
|
||||
public partial class PowerOcrViewModel : Observable, IDisposable
|
||||
{
|
||||
private bool disposedValue;
|
||||
|
||||
@@ -236,7 +237,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
PowerOcrSettings.ModuleName,
|
||||
JsonSerializer.Serialize(_powerOcrSettings)));
|
||||
JsonSerializer.Serialize(_powerOcrSettings, SourceGenerationContextContext.Default.PowerOcrSettings)));
|
||||
}
|
||||
|
||||
public void RefreshEnabledState()
|
||||
|
||||
@@ -13,7 +13,7 @@ using Settings.UI.Library.Enumerations;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class PowerPreviewViewModel : Observable
|
||||
public partial class PowerPreviewViewModel : Observable
|
||||
{
|
||||
private const string ModuleName = PowerPreviewSettings.ModuleName;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class PowerRenameViewModel : Observable
|
||||
public partial class PowerRenameViewModel : Observable
|
||||
{
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
|
||||
@@ -11,10 +11,11 @@ using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class RegistryPreviewViewModel : Observable
|
||||
public partial class RegistryPreviewViewModel : Observable
|
||||
{
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
@@ -121,7 +122,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
RegistryPreviewSettings.ModuleName,
|
||||
JsonSerializer.Serialize(_settings)));
|
||||
JsonSerializer.Serialize(_settings, SourceGenerationContextContext.Default.RegistryPreviewSettings)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ using Windows.System;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class ShellViewModel : Observable
|
||||
public partial class ShellViewModel : Observable
|
||||
{
|
||||
private readonly KeyboardAccelerator altLeftKeyboardAccelerator = BuildKeyboardAccelerator(VirtualKey.Left, VirtualKeyModifiers.Menu);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class ShortcutGuideViewModel : Observable
|
||||
public partial class ShortcutGuideViewModel : Observable
|
||||
{
|
||||
private ISettingsUtils SettingsUtils { get; set; }
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@ using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
||||
using Microsoft.PowerToys.Settings.UI.SerializationContext;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class WorkspacesViewModel : Observable
|
||||
public partial class WorkspacesViewModel : Observable
|
||||
{
|
||||
private ISettingsUtils SettingsUtils { get; set; }
|
||||
|
||||
@@ -131,7 +132,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
CultureInfo.InvariantCulture,
|
||||
"{{ \"powertoys\": {{ \"{0}\": {1} }} }}",
|
||||
WorkspacesSettings.ModuleName,
|
||||
JsonSerializer.Serialize(Settings)));
|
||||
JsonSerializer.Serialize(Settings, SourceGenerationContextContext.Default.WorkspacesSettings)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user