// 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()!; var topLevelCommandManager = App.Current.Services.GetService()!; var themeService = App.Current.Services.GetService()!; viewModel = new SettingsViewModel(settings, topLevelCommandManager, _mainTaskScheduler, themeService); } private void ListView_DragItemsCompleted(ListViewBase sender, DragItemsCompletedEventArgs args) { viewModel?.ApplyFallbackSort(); } }