eb2ef7070b
* Removed hardcoded background * Background * Updated pages * Added OOBE to shellpage * Margin fixes * Fix * Resource update * Resource string update * Removed reference from installer file * Updated UI fixes and remove conflicts * Adding new settings control * PowerRename * Sidepanel updates * Shortcut Guide * Updates screeens * General page updates * Awake UX update * Changed order for power preview note * Fixes * UI fixes * KBM * IsEnabled state support * Added new controls * Update * Updated nugest packages * Replaced itemscontrol * Introducing setting button style * FancyZones page * Plugin page * Switch case * Fixed typo * Plugin manager update * Introducing SettingExpander * Setting automation properties * Accesibility improvements * VCM and cleanup * Refactoring OOBE pages part 1 * OOBE XAML refactoring * Added MinWidth to actioncontent controls * Updates to various settings * Spell update * Update to author label * Clean up * Removing redunant files * Move file * Updated files * Revert "Updated files" This reverts commit1a5c887eae
. * Revert "Move file" This reverts commit2b06c75c1f
. * Revert "Removing redunant files" This reverts commitfe79ec1701
. * Revert "Clean up" This reverts commit028e15fab6
. * Removed redundant styles * Revert "Removed redundant styles" This reverts commitdfdfd65021
. * Files cleanup * Removing converter, updating background and paddings * Styling updates * Unit test updates * Fixes * Installer fixes * Update Resources.resw * Shell page updates * Updated pagelinks * Styles re-ordering * Updated converter * Updated ToggleSwitch style * Bugfixes * Typo fix * [Settings] New UX - installer dll fixes (#12818) * [Settings] New UX - Fix some failing tests (#12822) * Bugfixes * Typo fix * Hiding VCM * Bugfixes * Download button fix * Remove Newtonsoft.Json from installer file * Updated visuals * Bugfixes * Syntax fix * Updated installer file * Bugfixes * New label * Theming support for OOBE * Put back in Documentation hyperlink * Right uid Co-authored-by: Niels Laute <niels9001@hotmail.com> Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
104 lines
4.7 KiB
C#
104 lines
4.7 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 System;
|
|
using System.Collections.ObjectModel;
|
|
using System.IO;
|
|
using Microsoft.PowerToys.Settings.UI.Library;
|
|
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
|
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
|
|
using Windows.UI.Xaml.Controls;
|
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Views
|
|
{
|
|
public sealed partial class PowerLauncherPage : Page
|
|
{
|
|
public PowerLauncherViewModel ViewModel { get; set; }
|
|
|
|
private readonly ObservableCollection<Tuple<string, string>> searchResultPreferencesOptions;
|
|
private readonly ObservableCollection<Tuple<string, string>> searchTypePreferencesOptions;
|
|
|
|
public PowerLauncherPage()
|
|
{
|
|
InitializeComponent();
|
|
var settingsUtils = new SettingsUtils();
|
|
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;
|
|
try
|
|
{
|
|
powerLauncherSettings = settingsUtils.GetSettingsOrDefault<PowerLauncherSettings>(PowerLauncherSettings.ModuleName);
|
|
}
|
|
catch (IOException ex)
|
|
{
|
|
Logger.LogInfo(ex.Message);
|
|
}
|
|
|
|
if (powerLauncherSettings != null && !ViewModel.IsUpToDate(powerLauncherSettings))
|
|
{
|
|
_ = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
|
|
{
|
|
DataContext = ViewModel = new PowerLauncherViewModel(powerLauncherSettings, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, App.IsDarkTheme);
|
|
this.Bindings.Update();
|
|
});
|
|
}
|
|
});
|
|
|
|
var loader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
|
|
|
|
searchResultPreferencesOptions = new ObservableCollection<Tuple<string, string>>();
|
|
searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_AlphabeticalOrder"), "alphabetical_order"));
|
|
searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_MostRecentlyUsed"), "most_recently_used"));
|
|
searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_RunningProcessesOpenApplications"), "running_processes_open_applications"));
|
|
|
|
searchTypePreferencesOptions = new ObservableCollection<Tuple<string, string>>();
|
|
searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ApplicationName"), "application_name"));
|
|
searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_StringInApplication"), "string_in_application"));
|
|
searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ExecutableName"), "executable_name"));
|
|
}
|
|
|
|
private void OpenColorsSettings_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
|
{
|
|
Helpers.StartProcessHelper.Start(Helpers.StartProcessHelper.ColorsSettings);
|
|
}
|
|
|
|
/*
|
|
public Tuple<string, string> SelectedSearchResultPreference
|
|
{
|
|
get
|
|
{
|
|
return searchResultPreferencesOptions.First(item => item.Item2 == ViewModel.SearchResultPreference);
|
|
}
|
|
|
|
set
|
|
{
|
|
if (ViewModel.SearchResultPreference != value.Item2)
|
|
{
|
|
ViewModel.SearchResultPreference = value.Item2;
|
|
}
|
|
}
|
|
}
|
|
|
|
public Tuple<string, string> SelectedSearchTypePreference
|
|
{
|
|
get
|
|
{
|
|
return searchTypePreferencesOptions.First(item => item.Item2 == ViewModel.SearchTypePreference);
|
|
}
|
|
|
|
set
|
|
{
|
|
if (ViewModel.SearchTypePreference != value.Item2)
|
|
{
|
|
ViewModel.SearchTypePreference = value.Item2;
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
}
|
|
}
|