mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 12:46:47 +02:00
Remove redundant OnPropertyChagned
This commit is contained in:
@@ -74,20 +74,23 @@ namespace Wox
|
|||||||
QueryTextBox.Focus();
|
QueryTextBox.Focus();
|
||||||
QueryTextBox.CaretIndex = QueryTextBox.Text.Length;
|
QueryTextBox.CaretIndex = QueryTextBox.Text.Length;
|
||||||
};
|
};
|
||||||
vm.MainWindowVisibilityChanged += (o, e) =>
|
vm.PropertyChanged += (o, e) =>
|
||||||
{
|
{
|
||||||
if (vm.MainWindowVisibility.IsVisible())
|
if (e.PropertyName == nameof(vm.MainWindowVisibility))
|
||||||
{
|
{
|
||||||
Activate();
|
if (vm.MainWindowVisibility.IsVisible())
|
||||||
QueryTextBox.Focus();
|
{
|
||||||
Left = GetWindowsLeft();
|
Activate();
|
||||||
Top = GetWindowsTop();
|
QueryTextBox.Focus();
|
||||||
_settings.ActivateTimes++;
|
Left = GetWindowsLeft();
|
||||||
}
|
Top = GetWindowsTop();
|
||||||
else
|
_settings.ActivateTimes++;
|
||||||
{
|
}
|
||||||
_settings.WindowLeft = Left;
|
else
|
||||||
_settings.WindowTop = Top;
|
{
|
||||||
|
_settings.WindowLeft = Left;
|
||||||
|
_settings.WindowTop = Top;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,13 +24,7 @@ namespace Wox.ViewModel
|
|||||||
{
|
{
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
private double _left;
|
|
||||||
private double _top;
|
|
||||||
|
|
||||||
private Visibility _contextMenuVisibility;
|
private Visibility _contextMenuVisibility;
|
||||||
private Visibility _progressBarVisibility;
|
|
||||||
private Visibility _resultListBoxVisibility;
|
|
||||||
private Visibility _mainWindowVisibility;
|
|
||||||
|
|
||||||
private bool _queryHasReturn;
|
private bool _queryHasReturn;
|
||||||
private Query _lastQuery;
|
private Query _lastQuery;
|
||||||
@@ -285,8 +279,6 @@ namespace Wox.ViewModel
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_queryText = value;
|
_queryText = value;
|
||||||
OnPropertyChanged();
|
|
||||||
|
|
||||||
if (_ignoreTextChange)
|
if (_ignoreTextChange)
|
||||||
{
|
{
|
||||||
_ignoreTextChange = false;
|
_ignoreTextChange = false;
|
||||||
@@ -298,25 +290,9 @@ namespace Wox.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Left
|
public double Left { get; set; }
|
||||||
{
|
|
||||||
get { return _left; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_left = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public double Top
|
public double Top { get; set; }
|
||||||
{
|
|
||||||
get { return _top; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_top = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Visibility ContextMenuVisibility
|
public Visibility ContextMenuVisibility
|
||||||
|
|
||||||
@@ -325,7 +301,6 @@ namespace Wox.ViewModel
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
_contextMenuVisibility = value;
|
_contextMenuVisibility = value;
|
||||||
OnPropertyChanged();
|
|
||||||
|
|
||||||
_ignoreTextChange = true;
|
_ignoreTextChange = true;
|
||||||
if (!value.IsVisible())
|
if (!value.IsVisible())
|
||||||
@@ -343,40 +318,16 @@ namespace Wox.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Visibility ProgressBarVisibility
|
public Visibility ProgressBarVisibility { get; set; }
|
||||||
{
|
|
||||||
get { return _progressBarVisibility; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_progressBarVisibility = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Visibility ResultListBoxVisibility
|
public Visibility ResultListBoxVisibility { get; set; }
|
||||||
{
|
|
||||||
get { return _resultListBoxVisibility; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_resultListBoxVisibility = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Visibility MainWindowVisibility
|
public Visibility MainWindowVisibility { get; set; }
|
||||||
{
|
|
||||||
get { return _mainWindowVisibility; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_mainWindowVisibility = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
MainWindowVisibilityChanged?.Invoke(this, new EventArgs());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICommand EscCommand { get; set; }
|
public ICommand EscCommand { get; set; }
|
||||||
public ICommand SelectNextItemCommand { get; set; }
|
public ICommand SelectNextItemCommand { get; set; }
|
||||||
public ICommand SelectPrevItemCommand { get; set; }
|
public ICommand SelectPrevItemCommand { get; set; }
|
||||||
|
//todo happlebao restore history command
|
||||||
public ICommand DisplayNextQueryCommand { get; set; }
|
public ICommand DisplayNextQueryCommand { get; set; }
|
||||||
public ICommand DisplayPrevQueryCommand { get; set; }
|
public ICommand DisplayPrevQueryCommand { get; set; }
|
||||||
public ICommand SelectNextPageCommand { get; set; }
|
public ICommand SelectNextPageCommand { get; set; }
|
||||||
@@ -701,7 +652,6 @@ namespace Wox.ViewModel
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public event EventHandler MainWindowVisibilityChanged;
|
|
||||||
public event EventHandler CursorMovedToEnd;
|
public event EventHandler CursorMovedToEnd;
|
||||||
|
|
||||||
public void OnCursorMovedToEnd()
|
public void OnCursorMovedToEnd()
|
||||||
|
|||||||
@@ -13,9 +13,7 @@ namespace Wox.ViewModel
|
|||||||
{
|
{
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
private int _selectedIndex;
|
|
||||||
public ResultCollection Results { get; }
|
public ResultCollection Results { get; }
|
||||||
private Thickness _margin;
|
|
||||||
|
|
||||||
private readonly object _addResultsLock = new object();
|
private readonly object _addResultsLock = new object();
|
||||||
private readonly object _collectionLock = new object();
|
private readonly object _collectionLock = new object();
|
||||||
@@ -45,29 +43,10 @@ namespace Wox.ViewModel
|
|||||||
|
|
||||||
public int MaxHeight => MaxResults * 50;
|
public int MaxHeight => MaxResults * 50;
|
||||||
|
|
||||||
public int SelectedIndex
|
public int SelectedIndex { get; set; }
|
||||||
{
|
|
||||||
get { return _selectedIndex; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_selectedIndex = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResultViewModel SelectedItem { get; set; }
|
public ResultViewModel SelectedItem { get; set; }
|
||||||
public Thickness Margin
|
public Thickness Margin { get; set; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _margin;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_margin = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user