mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-12 15:26:28 +01:00
More renaming and making stuff private
This commit is contained in:
@@ -31,7 +31,7 @@ internal sealed class MediaListItem : ListItem
|
||||
});
|
||||
|
||||
// task.Start();
|
||||
this._MoreCommands = null;
|
||||
MoreCommands = null;
|
||||
}
|
||||
|
||||
private async Task UpdateProperties()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
@@ -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 = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user