PowerToys/src/settings-ui/Settings.UI/ViewModels/DashboardModuleItem.cs

76 lines
2.3 KiB
C#
Raw Normal View History

[Settings]Adding a Dashboard Panel (#29023) * Dashboard: modifying page content + adding SW version button. * Visual tweaks and minor viewmodel changes * Updated spacing * Adding Settings icon * Settiing the Dashboard page as the default one. Adding functionality to switch to settings pages from the Dashboard page. Localizing texts. * fixing csproj file * Reimplementing Active modules handling, showing only the active modules (and not having invisible inactive modules). * Removing unneccessary binding * Fix text wrapping * Adding Registry previewer launch, adding activation mode for FindMyMouse and QuickAccent, modify File Locksmith description. * Spell checker fix typo * Adding GPO-blocked state, modifying buttons: adding description, icon. * Modifying dashboard button layout * Use SettingsCard instead of button * Restructuring the dashboard panel * Removing togglebuttons from the left panel. Showing only active modules. Adding key remappings (to KBM) * Removing settings buttons, removing descriptions, icons from buttons. Add update of remapped keys, shortcuts. * Refactoring dashboard * Making list always visible and fixing scrolling behavior * Adding background gradient to cards * Removing keyboard manager's key mappings, minor changes in texts, fixing enabled state when GPO-enabled. * Use ListView instead of ItemsRepeater * Updates * removing right panel with all modules. Extending "left" panel with toggleswitches, showing all modules. * Separate lists * Adding Flyout with key remappings for KBM module, adding IsLocked property, icons * Visual tweaks * Tweaks * Fixing lock icon margin * Minor fixes. * Removing unused resources * Make Dashboard default when coming from the OOBE General * Removed the Previous, Next Layout buttons from FancyZones. Added activation information --------- Co-authored-by: Niels Laute <niels.laute@live.nl>
2023-10-20 20:23:25 +08:00
// 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.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.UI.Xaml;
using Windows.UI;
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 class DashboardModuleButtonItem : DashboardModuleItem
{
public string ButtonTitle { get; set; }
public bool IsButtonDescriptionVisible { get; set; }
public string ButtonDescription { get; set; }
public string ButtonGlyph { get; set; }
public RoutedEventHandler ButtonClickHandler { get; set; }
}
public class DashboardModuleShortcutItem : DashboardModuleItem
{
public List<object> Shortcut { get; set; }
}
public class DashboardModuleKBMItem : DashboardModuleItem
{
private List<KeysDataModel> _remapKeys = new List<KeysDataModel>();
public List<KeysDataModel> RemapKeys
{
get => _remapKeys;
set => _remapKeys = value;
}
private List<AppSpecificKeysDataModel> _remapShortcuts = new List<AppSpecificKeysDataModel>();
public List<AppSpecificKeysDataModel> RemapShortcuts
{
get => _remapShortcuts;
set => _remapShortcuts = value;
}
}
public class DashboardModuleItem : INotifyPropertyChanged
{
public string Label { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
internal void NotifyPropertyChanged(string propertyName)
{
OnPropertyChanged(propertyName);
}
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
#pragma warning restore SA1402 // File may only contain a single type
#pragma warning restore SA1649 // File name should match first type name