mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-12 10:19:20 +08:00
whitespace changes (#5750)
This commit is contained in:
parent
b815718c26
commit
26bf05dd7e
@ -106,7 +106,6 @@ namespace PowerLauncher
|
||||
InternationalizationManager.Instance.ChangeLanguage(_settings.Language);
|
||||
|
||||
// main windows needs initialized before theme change because of blur settings
|
||||
|
||||
Http.Proxy = _settings.Proxy;
|
||||
|
||||
RegisterExitEvents();
|
||||
@ -203,7 +202,6 @@ namespace PowerLauncher
|
||||
// // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||
// Dispose(disposing: false);
|
||||
// }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||
|
@ -34,6 +34,7 @@ namespace PowerLauncher.Helper
|
||||
{
|
||||
// handle ui thread exceptions
|
||||
Report(e?.Exception);
|
||||
|
||||
// prevent application exist, so the user can copy prompted error info
|
||||
e.Handled = true;
|
||||
}
|
||||
|
@ -17,21 +17,25 @@ namespace PowerLauncher.Helper
|
||||
{
|
||||
state.ShiftPressed = true;
|
||||
}
|
||||
|
||||
if ((Keyboard.GetKeyStates(Key.LWin) & KeyStates.Down) > 0 ||
|
||||
(Keyboard.GetKeyStates(Key.RWin) & KeyStates.Down) > 0)
|
||||
{
|
||||
state.WinPressed = true;
|
||||
}
|
||||
|
||||
if ((Keyboard.GetKeyStates(Key.LeftCtrl) & KeyStates.Down) > 0 ||
|
||||
(Keyboard.GetKeyStates(Key.RightCtrl) & KeyStates.Down) > 0)
|
||||
{
|
||||
state.CtrlPressed = true;
|
||||
}
|
||||
|
||||
if ((Keyboard.GetKeyStates(Key.LeftAlt) & KeyStates.Down) > 0 ||
|
||||
(Keyboard.GetKeyStates(Key.RightAlt) & KeyStates.Down) > 0)
|
||||
{
|
||||
state.AltPressed = true;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,5 @@ namespace PowerLauncher.Helper
|
||||
{
|
||||
CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -188,6 +188,7 @@ namespace PowerLauncher.Helper
|
||||
{
|
||||
throw new Win32Exception();
|
||||
}
|
||||
|
||||
var result = new string[numArgs];
|
||||
|
||||
for (int i = 0; i < numArgs; i++)
|
||||
@ -201,11 +202,11 @@ namespace PowerLauncher.Helper
|
||||
finally
|
||||
{
|
||||
IntPtr p = _LocalFree(argv);
|
||||
|
||||
// Otherwise LocalFree failed.
|
||||
// Assert.AreEqual(IntPtr.Zero, p);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public interface ISingleInstanceApp
|
||||
@ -359,6 +360,7 @@ namespace PowerLauncher.Helper
|
||||
// Do an asynchronous call to ActivateFirstInstance function
|
||||
Application.Current.Dispatcher.Invoke(ActivateFirstInstance);
|
||||
}
|
||||
|
||||
// Disconnect client
|
||||
pipeServer.Disconnect();
|
||||
}
|
||||
|
@ -186,6 +186,7 @@ namespace PowerLauncher.Helper
|
||||
matrix = src.CompositionTarget.TransformFromDevice;
|
||||
}
|
||||
}
|
||||
|
||||
return new Point((int)(matrix.M11 * unitX), (int)(matrix.M22 * unitY));
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,6 @@ namespace PowerLauncher
|
||||
|
||||
_firstDeleteTimer.Elapsed += CheckForFirstDelete;
|
||||
_firstDeleteTimer.Interval = 1000;
|
||||
|
||||
}
|
||||
|
||||
private void CheckForFirstDelete(object sender, ElapsedEventArgs e)
|
||||
@ -53,7 +52,6 @@ namespace PowerLauncher
|
||||
PowerToysTelemetry.Log.WriteEvent(new LauncherFirstDeleteEvent());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public MainWindow()
|
||||
@ -251,7 +249,7 @@ namespace PowerLauncher
|
||||
}
|
||||
else if (e.Key == Key.Right)
|
||||
{
|
||||
if(SearchBox.QueryTextBox.CaretIndex == SearchBox.QueryTextBox.Text.Length)
|
||||
if (SearchBox.QueryTextBox.CaretIndex == SearchBox.QueryTextBox.Text.Length)
|
||||
{
|
||||
_viewModel.SelectNextContextMenuItemCommand.Execute(null);
|
||||
e.Handled = true;
|
||||
@ -261,7 +259,7 @@ namespace PowerLauncher
|
||||
{
|
||||
if (SearchBox.QueryTextBox.CaretIndex == SearchBox.QueryTextBox.Text.Length)
|
||||
{
|
||||
if(_viewModel.Results != null && _viewModel.Results.IsContextMenuItemSelected())
|
||||
if (_viewModel.Results != null && _viewModel.Results.IsContextMenuItemSelected())
|
||||
{
|
||||
_viewModel.SelectPreviousContextMenuItemCommand.Execute(null);
|
||||
e.Handled = true;
|
||||
@ -334,6 +332,7 @@ namespace PowerLauncher
|
||||
{
|
||||
SearchBox.AutoCompleteTextBlock.Text = string.Empty;
|
||||
}
|
||||
|
||||
_viewModel.QueryText = text;
|
||||
_viewModel.Query();
|
||||
}
|
||||
@ -356,8 +355,8 @@ namespace PowerLauncher
|
||||
{
|
||||
_firstDeleteTimer.Start();
|
||||
}
|
||||
// (this.FindResource("IntroStoryboard") as Storyboard).Begin();
|
||||
|
||||
// (this.FindResource("IntroStoryboard") as Storyboard).Begin();
|
||||
SearchBox.QueryTextBox.Focus();
|
||||
Keyboard.Focus(SearchBox.QueryTextBox);
|
||||
|
||||
@ -429,7 +428,6 @@ namespace PowerLauncher
|
||||
// // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||
// Dispose(disposing: false);
|
||||
// }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||
|
@ -25,10 +25,11 @@ namespace PowerLauncher
|
||||
{
|
||||
InitializeComponent();
|
||||
BitmapImage image = GetImageFromPath(ImageLoader.ErrorIconPath);
|
||||
if(image != null)
|
||||
if (image != null)
|
||||
{
|
||||
this.Icon = image;
|
||||
}
|
||||
|
||||
ErrorTextbox.Document.Blocks.FirstBlock.Margin = new Thickness(0);
|
||||
SetException(exception);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ namespace PowerLauncher
|
||||
public SettingsWatcher(Settings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
|
||||
// Set up watcher
|
||||
_watcher = Microsoft.PowerToys.Settings.UI.Lib.Utilities.Helper.GetFileWatcher(PowerLauncherSettings.ModuleName, "settings.json", OverloadSettings);
|
||||
|
||||
@ -38,7 +39,7 @@ namespace PowerLauncher
|
||||
Monitor.Enter(_watcherSyncObject);
|
||||
var retry = true;
|
||||
var retryCount = 0;
|
||||
while(retry)
|
||||
while (retry)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -90,6 +91,7 @@ namespace PowerLauncher
|
||||
|
||||
retry = false;
|
||||
}
|
||||
|
||||
// the settings application can hold a lock on the settings.json file which will result in a IOException.
|
||||
// This should be changed to properly synch with the settings app instead of retrying.
|
||||
catch (IOException e)
|
||||
@ -98,10 +100,12 @@ namespace PowerLauncher
|
||||
{
|
||||
retry = false;
|
||||
}
|
||||
|
||||
Thread.Sleep(1000);
|
||||
Debug.WriteLine(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
Monitor.Exit(_watcherSyncObject);
|
||||
}
|
||||
|
||||
@ -111,6 +115,5 @@ namespace PowerLauncher
|
||||
HotkeyModel model = new HotkeyModel(hotkey.Alt, hotkey.Shift, hotkey.Win, hotkey.Ctrl, key);
|
||||
return model.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ namespace PowerLauncher.Storage
|
||||
years += 1;
|
||||
return $"about {years} {(years == 1 ? "year" : "years")} ago";
|
||||
}
|
||||
|
||||
if (span.Days > 30)
|
||||
{
|
||||
int months = (span.Days / 30);
|
||||
@ -34,6 +35,7 @@ namespace PowerLauncher.Storage
|
||||
months += 1;
|
||||
return $"about {months} {(months == 1 ? "month" : "months")} ago";
|
||||
}
|
||||
|
||||
if (span.Days > 0)
|
||||
return $"about {span.Days} {(span.Days == 1 ? "day" : "days")} ago";
|
||||
if (span.Hours > 0)
|
||||
|
@ -43,7 +43,6 @@ namespace PowerLauncher.Storage
|
||||
SubTitle = result.SubTitle
|
||||
};
|
||||
records[result.OriginQuery.RawQuery] = record;
|
||||
|
||||
}
|
||||
|
||||
public void Load(Dictionary<string, Record> dictionary)
|
||||
|
@ -43,6 +43,7 @@ namespace PowerLauncher.Storage
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,6 @@ namespace PowerLauncher.ViewModel
|
||||
PluginName = PluginName,
|
||||
Trigger = triggerType.ToString(),
|
||||
ActionName = Title
|
||||
|
||||
};
|
||||
PowerToysTelemetry.Log.WriteEvent(eventData);
|
||||
}
|
||||
|
@ -260,6 +260,7 @@ namespace PowerLauncher.ViewModel
|
||||
if (!string.IsNullOrEmpty(QueryText))
|
||||
{
|
||||
ChangeQueryText(string.Empty, true);
|
||||
|
||||
// Push Event to UI SystemQuery has changed
|
||||
OnPropertyChanged(nameof(SystemQueryText));
|
||||
}
|
||||
@ -337,6 +338,7 @@ namespace PowerLauncher.ViewModel
|
||||
QueryText = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
_selectedResults.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
@ -360,7 +362,6 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
PowerToysTelemetry.Log.WriteEvent(new LauncherHideEvent());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,7 +536,6 @@ namespace PowerLauncher.ViewModel
|
||||
QueryLength = query.RawQuery.Length
|
||||
};
|
||||
PowerToysTelemetry.Log.WriteEvent(queryEvent);
|
||||
|
||||
}, currentCancellationToken);
|
||||
}
|
||||
}
|
||||
@ -660,6 +660,7 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
StartHotkeyTimer();
|
||||
}
|
||||
|
||||
if (_settings.LastQueryMode == LastQueryMode.Empty)
|
||||
{
|
||||
ChangeQueryText(string.Empty);
|
||||
@ -772,7 +773,9 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
var _ = PluginManager.QueryForPlugin(plugin, query);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
public void HandleContextMenu(Key AcceleratorKey, ModifierKeys AcceleratorModifiers)
|
||||
@ -819,6 +822,7 @@ namespace PowerLauncher.ViewModel
|
||||
return query + input.Substring(query.Length);
|
||||
}
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
@ -849,6 +853,7 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
_hotkeyManager?.UnregisterHotkey(_hotkeyHandle);
|
||||
}
|
||||
|
||||
_hotkeyManager?.Dispose();
|
||||
_updateSource?.Dispose();
|
||||
_disposed = true;
|
||||
|
@ -20,7 +20,7 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
Selection,
|
||||
Hover
|
||||
};
|
||||
}
|
||||
|
||||
public ObservableCollection<ContextMenuItemViewModel> ContextMenuItems { get; } = new ObservableCollection<ContextMenuItemViewModel>();
|
||||
|
||||
|
@ -23,8 +23,8 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
private readonly object _collectionLock = new object();
|
||||
private readonly Settings _settings;
|
||||
// private int MaxResults => _settings?.MaxResultsToShow ?? 6;
|
||||
|
||||
// private int MaxResults => _settings?.MaxResultsToShow ?? 6;
|
||||
public ResultsViewModel()
|
||||
{
|
||||
Results = new ResultCollection();
|
||||
@ -105,6 +105,7 @@ namespace PowerLauncher.ViewModel
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
@ -189,9 +190,9 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
public void SelectNextContextMenuItem()
|
||||
{
|
||||
if(SelectedItem != null)
|
||||
if (SelectedItem != null)
|
||||
{
|
||||
if(!SelectedItem.SelectNextContextButton())
|
||||
if (!SelectedItem.SelectNextContextButton())
|
||||
{
|
||||
SelectedItem.SelectLastContextButton();
|
||||
}
|
||||
@ -229,7 +230,7 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
|
||||
List<ResultViewModel> newResults = new List<ResultViewModel>(newRawResults.Count);
|
||||
foreach(Result r in newRawResults)
|
||||
foreach (Result r in newRawResults)
|
||||
{
|
||||
newResults.Add(new ResultViewModel(r));
|
||||
ct.ThrowIfCancellationRequested();
|
||||
|
Loading…
Reference in New Issue
Block a user