mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
32 lines
1.2 KiB
C#
32 lines
1.2 KiB
C#
|
|
// 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 Microsoft.CmdPal.UI.ViewModels;
|
||
|
|
using Microsoft.CmdPal.UI.ViewModels.Services;
|
||
|
|
using Microsoft.Extensions.DependencyInjection;
|
||
|
|
using Microsoft.UI.Xaml.Controls;
|
||
|
|
|
||
|
|
namespace Microsoft.CmdPal.UI.Controls;
|
||
|
|
|
||
|
|
public sealed partial class FallbackRanker : UserControl
|
||
|
|
{
|
||
|
|
private readonly TaskScheduler _mainTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext();
|
||
|
|
private SettingsViewModel? viewModel;
|
||
|
|
|
||
|
|
public FallbackRanker()
|
||
|
|
{
|
||
|
|
this.InitializeComponent();
|
||
|
|
|
||
|
|
var settings = App.Current.Services.GetService<SettingsModel>()!;
|
||
|
|
var topLevelCommandManager = App.Current.Services.GetService<TopLevelCommandManager>()!;
|
||
|
|
var themeService = App.Current.Services.GetService<IThemeService>()!;
|
||
|
|
viewModel = new SettingsViewModel(settings, topLevelCommandManager, _mainTaskScheduler, themeService);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void ListView_DragItemsCompleted(ListViewBase sender, DragItemsCompletedEventArgs args)
|
||
|
|
{
|
||
|
|
viewModel?.ApplyFallbackSort();
|
||
|
|
}
|
||
|
|
}
|