Delete Fody and PropertyChanged.Fody (#9120)

This commit is contained in:
Mykhailo Pylyp
2021-01-20 11:23:56 +02:00
committed by GitHub
parent d2a1ac9c3f
commit 433e2e57ed
11 changed files with 163 additions and 184 deletions

View File

@@ -15,11 +15,50 @@ namespace PowerLauncher.ViewModel
public string PluginName { get; set; }
public string Title { get; set; }
private string _title;
public string Glyph { get; set; }
public string Title
{
get => _title;
set
{
if (_title != value)
{
_title = value;
OnPropertyChanged(nameof(Title));
}
}
}
public string FontFamily { get; set; }
private string _glyph;
public string Glyph
{
get => _glyph;
set
{
if (_glyph != value)
{
_glyph = value;
OnPropertyChanged(nameof(Glyph));
}
}
}
private string _fontFamily;
public string FontFamily
{
get => _fontFamily;
set
{
if (_fontFamily != value)
{
_fontFamily = value;
OnPropertyChanged(nameof(FontFamily));
}
}
}
public ICommand Command
{

View File

@@ -296,15 +296,55 @@ namespace PowerLauncher.ViewModel
public Brush MainWindowBorderBrush { get; set; }
public ResultsViewModel Results { get; private set; }
private ResultsViewModel _results;
public ResultsViewModel Results
{
get => _results;
private set
{
if (value != _results)
{
_results = value;
OnPropertyChanged(nameof(Results));
}
}
}
public ResultsViewModel ContextMenu { get; private set; }
public ResultsViewModel History { get; private set; }
public string SystemQueryText { get; set; } = string.Empty;
private string _systemQueryText = string.Empty;
public string QueryText { get; set; } = string.Empty;
public string SystemQueryText
{
get => _systemQueryText;
set
{
if (_systemQueryText != value)
{
_systemQueryText = value;
OnPropertyChanged(nameof(SystemQueryText));
}
}
}
private string _queryText = string.Empty;
public string QueryText
{
get => _queryText;
set
{
if (_queryText != value)
{
_queryText = value;
OnPropertyChanged(nameof(QueryText));
}
}
}
/// <summary>
/// we need move cursor to end when we manually changed query
@@ -380,7 +420,12 @@ namespace PowerLauncher.ViewModel
set
{
_visibility = value;
if (_visibility != value)
{
_visibility = value;
OnPropertyChanged(nameof(MainWindowVisibility));
}
if (value == Visibility.Visible)
{
PowerToysTelemetry.Log.WriteEvent(new LauncherShowEvent());

View File

@@ -36,9 +36,35 @@ namespace PowerLauncher.ViewModel
public bool IsHovered { get; set; }
public bool AreContextButtonsActive { get; set; }
private bool _areContextButtonsActive;
public int ContextMenuSelectedIndex { get; set; }
public bool AreContextButtonsActive
{
get => _areContextButtonsActive;
set
{
if (_areContextButtonsActive != value)
{
_areContextButtonsActive = value;
OnPropertyChanged(nameof(AreContextButtonsActive));
}
}
}
private int _contextMenuSelectedIndex;
public int ContextMenuSelectedIndex
{
get => _contextMenuSelectedIndex;
set
{
if (_contextMenuSelectedIndex != value)
{
_contextMenuSelectedIndex = value;
OnPropertyChanged(nameof(ContextMenuSelectedIndex));
}
}
}
public const int NoSelectionIndex = -1;

View File

@@ -52,7 +52,20 @@ namespace PowerLauncher.ViewModel
}
}
public int SelectedIndex { get; set; }
private int _selectedIndex;
public int SelectedIndex
{
get => _selectedIndex;
set
{
if (_selectedIndex != value)
{
_selectedIndex = value;
OnPropertyChanged(nameof(SelectedIndex));
}
}
}
private ResultViewModel _selectedItem;
@@ -84,7 +97,20 @@ namespace PowerLauncher.ViewModel
public Thickness Margin { get; set; }
public Visibility Visibility { get; set; } = Visibility.Hidden;
private Visibility _visibility = Visibility.Hidden;
public Visibility Visibility
{
get => _visibility;
set
{
if (_visibility != value)
{
_visibility = value;
OnPropertyChanged(nameof(Visibility));
}
}
}
public ResultCollection Results { get; }