More renaming and making stuff private

This commit is contained in:
Clint Rutkas
2024-09-05 13:09:45 -07:00
parent 4b7b728825
commit cd59754031
5 changed files with 34 additions and 25 deletions

View File

@@ -31,7 +31,7 @@ internal sealed class MediaListItem : ListItem
});
// task.Start();
this._MoreCommands = null;
MoreCommands = null;
}
private async Task UpdateProperties()

View File

@@ -2,26 +2,35 @@
public class ListItem : BaseObservable, IListItem
{
protected string _Title = "";
protected string _Subtitle = "";
protected ITag[] _Tags = [];
protected IDetails? _Details;
protected ICommand _Command;
protected IContextItem[] _MoreCommands = [];
protected IFallbackHandler? _FallbackHandler;
private string _title = "";
private string _subtitle = "";
private ITag[] _tags = [];
private IDetails? _details;
private ICommand _command;
private IContextItem[] _moreCommands = [];
private IFallbackHandler? _fallbackHandler;
public string Title { get => !string.IsNullOrEmpty(this._Title) ? this._Title : _Command.Name; set { _Title = value; OnPropertyChanged(nameof(Title)); } }
public string Subtitle { get => _Subtitle; set { _Subtitle = value; OnPropertyChanged(nameof(Subtitle)); } }
public ITag[] Tags { get => _Tags; set { _Tags = value; OnPropertyChanged(nameof(Tags)); } }
public IDetails? Details { get => _Details; set { _Details = value; OnPropertyChanged(nameof(Details)); } }
public ICommand Command { get => _Command; set { _Command = value; OnPropertyChanged(nameof(Command)); } }
public IContextItem[] MoreCommands { get => _MoreCommands; set { _MoreCommands = value; OnPropertyChanged(nameof(MoreCommands)); } }
public string Title
{
get => !string.IsNullOrEmpty(this._title) ? this._title : _command.Name;
set
{
_title = value; OnPropertyChanged(nameof(Title));
}
public IFallbackHandler? FallbackHandler { get => _FallbackHandler ?? _Command as IFallbackHandler; init { _FallbackHandler = value; } }
}
public string Subtitle { get => _subtitle; set { _subtitle = value; OnPropertyChanged(nameof(Subtitle)); } }
public ITag[] Tags { get => _tags; set { _tags = value; OnPropertyChanged(nameof(Tags)); } }
public IDetails? Details { get => _details; set { _details = value; OnPropertyChanged(nameof(Details)); } }
public ICommand Command { get => _command; set { _command = value; OnPropertyChanged(nameof(Command)); } }
public IContextItem[] MoreCommands { get => _moreCommands; set { _moreCommands = value; OnPropertyChanged(nameof(MoreCommands)); } }
public IFallbackHandler? FallbackHandler { get => _fallbackHandler ?? _command as IFallbackHandler; init { _fallbackHandler = value; } }
public ListItem(ICommand command)
{
_Command = command;
_Title = command.Name;
Command = command;
Title = command.Name;
}
}

View File

@@ -18,7 +18,7 @@ public class CalculatorTopLevelListItem : ListItem, IFallbackHandler
{
// In the case of the calculator, the ListItem itself is the fallback
// handler, so that it can update it's Title and Subtitle accodingly.
_FallbackHandler = this;
FallbackHandler = this;
Subtitle = "Type an equation";
}

View File

@@ -22,14 +22,14 @@ internal sealed class AppListItem : ListItem
if (string.IsNullOrEmpty(app.UserModelId))
{
// Win32 exe or other non UWP app
this._MoreCommands = [
MoreCommands = [
new CommandContextItem(new OpenPathAction(app.DirPath) { Name = "Open location", Icon = new("\ue838") })
];
}
else
{
// UWP app
this._MoreCommands = [];
MoreCommands = [];
}
}
}

View File

@@ -19,11 +19,11 @@ public sealed class MainListItem : ListItem
{
_listItem = listItem;
_Title = _listItem.Title ?? _listItem.Command.Name;
_Subtitle = _listItem.Subtitle;
_MoreCommands = _listItem.MoreCommands;
_FallbackHandler = _listItem.FallbackHandler;
_Tags = _listItem.Tags;
Title = _listItem.Title ?? _listItem.Command.Name;
Subtitle = _listItem.Subtitle;
MoreCommands = _listItem.MoreCommands;
FallbackHandler = _listItem.FallbackHandler;
Tags = _listItem.Tags;
Command.PropChanged += Action_PropertyChanged;
_listItem.PropChanged += Action_PropertyChanged;