Stylecop compliance

This commit is contained in:
Tomas Raies
2020-04-08 00:19:00 -07:00
committed by Tomas Agustin Raies
parent 443b3c8b82
commit a85b84fd56
17 changed files with 260 additions and 183 deletions

View File

@@ -56,7 +56,7 @@
<ComboBox x:Uid="PowerLauncher_SearchResultPreference"
MinWidth="320"
Margin="{StaticResource SmallTopMargin}"
ItemsSource="{x:Bind SearchResultPreferencesOptions}"
ItemsSource="{x:Bind searchResultPreferencesOptions}"
SelectedItem="{x:Bind Mode=TwoWay, Path=SelectedSearchResultPreference}"
SelectedValuePath="Item2"
DisplayMemberPath="Item1"
@@ -65,7 +65,7 @@
<ComboBox x:Uid="PowerLauncher_SearchTypePreference"
MinWidth="320"
Margin="{StaticResource SmallTopMargin}"
ItemsSource="{x:Bind SearchTypePreferencesOptions}"
ItemsSource="{x:Bind searchTypePreferencesOptions}"
SelectedItem="{x:Bind Mode=TwoWay, Path=SelectedSearchTypePreference}"
SelectedValuePath="Item2"
DisplayMemberPath="Item1"

View File

@@ -1,63 +1,50 @@
// 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.PowerToys.Settings.UI.ViewModels;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Microsoft.PowerToys.Settings.UI.Controls;
using System.Collections.ObjectModel;
using System.Linq;
using Microsoft.PowerToys.Settings.UI.ViewModels;
using Windows.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class PowerLauncherPage : Page
{
public PowerLauncherViewModel ViewModel { get; } = new PowerLauncherViewModel();
ObservableCollection<Tuple<string, string>> SearchResultPreferencesOptions;
ObservableCollection<Tuple<string, string>> SearchTypePreferencesOptions;
private readonly ObservableCollection<Tuple<string, string>> searchResultPreferencesOptions;
private readonly ObservableCollection<Tuple<string, string>> searchTypePreferencesOptions;
public PowerLauncherPage()
{
this.InitializeComponent();
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"));
this.searchResultPreferencesOptions = new ObservableCollection<Tuple<string, string>>();
this.searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_AlphabeticalOrder"), "alphabetical_order"));
this.searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_MostRecentlyUsed"), "most_recently_used"));
this.searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_RunningProcessesOpenApplications"), "running_processes_open_applications"));
this.searchTypePreferencesOptions = new ObservableCollection<Tuple<string, string>>();
this.searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ApplicationName"), "application_name"));
this.searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_StringInApplication"), "string_in_application"));
this.searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ExecutableName"), "executable_name"));
}
public Tuple<string, string> SelectedSearchResultPreference
{
get
{
return SearchResultPreferencesOptions.First(item => item.Item2 == ViewModel.SearchResultPreference);
return this.searchResultPreferencesOptions.First(item => item.Item2 == this.ViewModel.SearchResultPreference);
}
set
{
if (ViewModel.SearchResultPreference != value.Item2)
if (this.ViewModel.SearchResultPreference != value.Item2)
{
ViewModel.SearchResultPreference = value.Item2;
this.ViewModel.SearchResultPreference = value.Item2;
}
}
}
@@ -66,13 +53,14 @@ namespace Microsoft.PowerToys.Settings.UI.Views
{
get
{
return SearchTypePreferencesOptions.First(item => item.Item2 == ViewModel.SearchTypePreference);
return this.searchTypePreferencesOptions.First(item => item.Item2 == this.ViewModel.SearchTypePreference);
}
set
{
if (ViewModel.SearchTypePreference != value.Item2)
if (this.ViewModel.SearchTypePreference != value.Item2)
{
ViewModel.SearchTypePreference = value.Item2;
this.ViewModel.SearchTypePreference = value.Item2;
}
}
}

View File

@@ -1,4 +1,8 @@
using Microsoft.PowerToys.Settings.UI.ViewModels;
// 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.PowerToys.Settings.UI.ViewModels;
using Windows.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views