wrapping up everything minus var renaming (#5952)
This commit is contained in:
parent
913615f1c2
commit
5c1713f274
|
@ -7,7 +7,6 @@ using System.Windows.Input;
|
|||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib.ViewModels.Commands
|
||||
{
|
||||
|
||||
public class RelayCommand<T> : ICommand
|
||||
{
|
||||
private readonly Action<T> execute;
|
||||
|
|
|
@ -12,9 +12,10 @@ namespace Wox
|
|||
{
|
||||
public partial class ActionKeywords : Window
|
||||
{
|
||||
private readonly Internationalization _translater = InternationalizationManager.Instance;
|
||||
|
||||
private PluginPair _plugin;
|
||||
private Settings _settings;
|
||||
private readonly Internationalization _translater = InternationalizationManager.Instance;
|
||||
|
||||
public ActionKeywords(string pluginId, Settings settings)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace PowerLauncher
|
|||
{
|
||||
public static PublicAPIInstance API { get; private set; }
|
||||
|
||||
private readonly Alphabet _alphabet = new Alphabet();
|
||||
|
||||
private const string Unique = "PowerLauncher_Unique_Application_Mutex";
|
||||
private static bool _disposed = false;
|
||||
private static int _powerToysPid;
|
||||
|
@ -35,7 +37,6 @@ namespace PowerLauncher
|
|||
private MainWindow _mainWindow;
|
||||
private ThemeManager _themeManager;
|
||||
private SettingWindowViewModel _settingsVM;
|
||||
private readonly Alphabet _alphabet = new Alphabet();
|
||||
private StringMatcher _stringMatcher;
|
||||
private SettingsWatcher _settingsWatcher;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace PowerLauncher.Helper
|
|||
{
|
||||
public class DataWebRequestFactory : IWebRequestCreate
|
||||
{
|
||||
class DataWebRequest : WebRequest
|
||||
private class DataWebRequest : WebRequest
|
||||
{
|
||||
private readonly Uri m_uri;
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace PowerLauncher.Helper
|
|||
}
|
||||
}
|
||||
|
||||
class DataWebResponse : WebResponse
|
||||
private class DataWebResponse : WebResponse
|
||||
{
|
||||
private readonly string m_contentType;
|
||||
private readonly byte[] m_data;
|
||||
|
|
|
@ -7,7 +7,7 @@ using Wox.Plugin;
|
|||
|
||||
namespace PowerLauncher.Helper
|
||||
{
|
||||
class KeyboardHelper
|
||||
internal class KeyboardHelper
|
||||
{
|
||||
public static SpecialKeyState CheckModifiers()
|
||||
{
|
||||
|
|
|
@ -223,7 +223,6 @@ namespace PowerLauncher.Helper
|
|||
/// </remarks>
|
||||
public static class SingleInstance<TApplication>
|
||||
where TApplication : Application, ISingleInstanceApp
|
||||
|
||||
{
|
||||
/// <summary>
|
||||
/// String delimiter used in channel names.
|
||||
|
@ -369,7 +368,7 @@ namespace PowerLauncher.Helper
|
|||
/// <summary>
|
||||
/// Callback for activating first instance of the application.
|
||||
/// </summary>
|
||||
/// <param name="arg">Callback argument.</param>
|
||||
/// <param name="args">Callback argument.</param>
|
||||
/// <returns>Always null.</returns>
|
||||
private static object ActivateFirstInstanceCallback(object _)
|
||||
{
|
||||
|
|
|
@ -98,10 +98,10 @@ namespace PowerLauncher.Helper
|
|||
INPUTHARDWARE = 2,
|
||||
}
|
||||
|
||||
const string WINDOW_CLASS_CONSOLE = "ConsoleWindowClass";
|
||||
const string WINDOW_CLASS_WINTAB = "Flip3D";
|
||||
const string WINDOW_CLASS_PROGMAN = "Progman";
|
||||
const string WINDOW_CLASS_WORKERW = "WorkerW";
|
||||
private const string WINDOW_CLASS_CONSOLE = "ConsoleWindowClass";
|
||||
private const string WINDOW_CLASS_WINTAB = "Flip3D";
|
||||
private const string WINDOW_CLASS_PROGMAN = "Progman";
|
||||
private const string WINDOW_CLASS_WORKERW = "WorkerW";
|
||||
|
||||
public static bool IsWindowFullscreen()
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ namespace PowerLauncher.Helper
|
|||
}
|
||||
else
|
||||
{
|
||||
using (var src = new HwndSource(new HwndSourceParameters()))
|
||||
using (var src = new HwndSource(default(HwndSourceParameters)))
|
||||
{
|
||||
matrix = src.CompositionTarget.TransformFromDevice;
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@ namespace PowerLauncher
|
|||
private Settings _settings;
|
||||
private MainViewModel _viewModel;
|
||||
private bool _isTextSetProgrammatically;
|
||||
bool _deletePressed = false;
|
||||
Timer _firstDeleteTimer = new Timer();
|
||||
bool _coldStateHotkeyPressed = false;
|
||||
private bool _deletePressed = false;
|
||||
private Timer _firstDeleteTimer = new Timer();
|
||||
private bool _coldStateHotkeyPressed = false;
|
||||
|
||||
public MainWindow(Settings settings, MainViewModel mainVM)
|
||||
: this()
|
||||
|
@ -133,7 +133,7 @@ namespace PowerLauncher
|
|||
}
|
||||
else if (e.PropertyName == nameof(MainViewModel.SystemQueryText))
|
||||
{
|
||||
this._isTextSetProgrammatically = true;
|
||||
_isTextSetProgrammatically = true;
|
||||
if (_viewModel.Results != null)
|
||||
{
|
||||
SearchBox.QueryTextBox.Text = MainViewModel.GetSearchText(
|
||||
|
@ -209,7 +209,7 @@ namespace PowerLauncher
|
|||
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
||||
var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.X, 0);
|
||||
var dip2 = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.Width, 0);
|
||||
var left = (dip2.X - ActualWidth) / 2 + dip1.X;
|
||||
var left = ((dip2.X - ActualWidth) / 2) + dip1.X;
|
||||
return left;
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ namespace PowerLauncher
|
|||
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
||||
var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y);
|
||||
var dip2 = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Height);
|
||||
var top = (dip2.Y - this.SearchBox.ActualHeight) / 4 + dip1.Y;
|
||||
var top = ((dip2.Y - SearchBox.ActualHeight) / 4) + dip1.Y;
|
||||
return top;
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ namespace PowerLauncher
|
|||
{
|
||||
if (_isTextSetProgrammatically)
|
||||
{
|
||||
var textBox = ((TextBox)sender);
|
||||
var textBox = (TextBox)sender;
|
||||
textBox.SelectionStart = textBox.Text.Length;
|
||||
_isTextSetProgrammatically = false;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace PowerLauncher
|
|||
BitmapImage image = GetImageFromPath(ImageLoader.ErrorIconPath);
|
||||
if (image != null)
|
||||
{
|
||||
this.Icon = image;
|
||||
Icon = image;
|
||||
}
|
||||
|
||||
ErrorTextbox.Document.Blocks.FirstBlock.Margin = new Thickness(0);
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace PowerLauncher.Storage
|
|||
var span = DateTime.Now - dt;
|
||||
if (span.Days > 365)
|
||||
{
|
||||
int years = (span.Days / 365);
|
||||
int years = span.Days / 365;
|
||||
if (span.Days % 365 != 0)
|
||||
{
|
||||
years += 1;
|
||||
|
@ -33,7 +33,7 @@ namespace PowerLauncher.Storage
|
|||
|
||||
if (span.Days > 30)
|
||||
{
|
||||
int months = (span.Days / 30);
|
||||
int months = span.Days / 30;
|
||||
if (span.Days % 31 != 0)
|
||||
{
|
||||
months += 1;
|
||||
|
|
|
@ -25,15 +25,15 @@ namespace PowerLauncher.ViewModel
|
|||
{
|
||||
get
|
||||
{
|
||||
return this._command;
|
||||
return _command;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
// ICommand does not implement the INotifyPropertyChanged interface and must call OnPropertyChanged() to prevent memory leaks
|
||||
if (value != this._command)
|
||||
if (value != _command)
|
||||
{
|
||||
this._command = value;
|
||||
_command = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,10 +29,8 @@ namespace PowerLauncher.ViewModel
|
|||
{
|
||||
public class MainViewModel : BaseModel, ISavable, IDisposable
|
||||
{
|
||||
private Query _currentQuery;
|
||||
private static Query _emptyQuery = new Query();
|
||||
private static bool _disposed;
|
||||
private string _queryTextBeforeLeaveResults;
|
||||
|
||||
private readonly WoxJsonStorage<QueryHistory> _historyItemsStorage;
|
||||
private readonly WoxJsonStorage<UserSelectedRecord> _userSelectedRecordStorage;
|
||||
|
@ -41,6 +39,11 @@ namespace PowerLauncher.ViewModel
|
|||
private readonly QueryHistory _history;
|
||||
private readonly UserSelectedRecord _userSelectedRecord;
|
||||
private readonly TopMostRecord _topMostRecord;
|
||||
private readonly object _addResultsLock = new object();
|
||||
private readonly Internationalization _translator = InternationalizationManager.Instance;
|
||||
|
||||
private Query _currentQuery;
|
||||
private string _queryTextBeforeLeaveResults;
|
||||
|
||||
private CancellationTokenSource _updateSource { get; set; }
|
||||
|
||||
|
@ -50,11 +53,8 @@ namespace PowerLauncher.ViewModel
|
|||
private HotkeyManager _hotkeyManager { get; set; }
|
||||
|
||||
private ushort _hotkeyHandle;
|
||||
private readonly Internationalization _translator = InternationalizationManager.Instance;
|
||||
private System.Diagnostics.Stopwatch hotkeyTimer = new System.Diagnostics.Stopwatch();
|
||||
|
||||
private readonly object _addResultsLock = new object();
|
||||
|
||||
public MainViewModel(Settings settings)
|
||||
{
|
||||
_hotkeyManager = new HotkeyManager();
|
||||
|
@ -110,7 +110,8 @@ namespace PowerLauncher.ViewModel
|
|||
var plugin = (IResultUpdated)pair.Plugin;
|
||||
plugin.ResultsUpdated += (s, e) =>
|
||||
{
|
||||
Task.Run(() =>
|
||||
Task.Run(
|
||||
() =>
|
||||
{
|
||||
PluginManager.UpdatePluginMetadata(e.Results, pair.Metadata, e.Query);
|
||||
UpdateResultView(e.Results, e.Query, _updateToken);
|
||||
|
@ -257,6 +258,7 @@ namespace PowerLauncher.ViewModel
|
|||
if (!string.IsNullOrEmpty(QueryText))
|
||||
{
|
||||
ChangeQueryText(string.Empty, true);
|
||||
|
||||
// Push Event to UI SystemQuery has changed
|
||||
OnPropertyChanged(nameof(SystemQueryText));
|
||||
}
|
||||
|
@ -465,7 +467,8 @@ namespace PowerLauncher.ViewModel
|
|||
if (query != null)
|
||||
{
|
||||
_currentQuery = query;
|
||||
Task.Run(() =>
|
||||
Task.Run(
|
||||
() =>
|
||||
{
|
||||
Thread.Sleep(20);
|
||||
var plugins = PluginManager.ValidPluginsForQuery(query);
|
||||
|
|
|
@ -231,7 +231,7 @@ namespace PowerLauncher.ViewModel
|
|||
|
||||
public bool HasSelectedContextButton()
|
||||
{
|
||||
var isContextSelected = (ContextMenuSelectedIndex != NoSelectionIndex);
|
||||
var isContextSelected = ContextMenuSelectedIndex != NoSelectionIndex;
|
||||
return isContextSelected;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue