Root group up button disabled

Going back to home when opening a file from explorer no longer displays open file
Inverted Breadcrumb order to avoid reordering items
Update release notes
Code cleanup
This commit is contained in:
Geoffroy BONNEVILLE
2020-06-26 01:16:44 +02:00
parent 7dcd5a4a57
commit 1f06bf3ba7
9 changed files with 39 additions and 26 deletions

View File

@@ -16,7 +16,7 @@ namespace ModernKeePass.ViewModels
{
public ObservableCollection<BreadcrumbItem> BreadcrumbItems { get; }
public string ParentGroupName { get; private set; }
public Icon ParentGroupIcon { get; private set; }
public Icon ParentGroupIcon { get; private set; } = Icon.Folder;
public RelayCommand GoBackCommand { get; }
public RelayCommand GoUpCommand { get; private set; }
@@ -33,22 +33,22 @@ namespace ModernKeePass.ViewModels
BreadcrumbItems = new ObservableCollection<BreadcrumbItem>();
GoBackCommand = new RelayCommand(() => _navigation.GoBack());
GoToCommand = new RelayCommand<int>(GoTo);
GoUpCommand = new RelayCommand(() => GoTo(BreadcrumbItems.Count - 1), () => !string.IsNullOrEmpty(ParentGroupName));
}
public async Task Initialize(GroupVm group)
{
GoUpCommand = new RelayCommand(() => GoTo(BreadcrumbItems.Count - 1), () => group != null);
if (group == null) return;
GoBackCommand.RaiseCanExecuteChanged();
ParentGroupName = group.Title;
ParentGroupIcon = group.Icon;
BreadcrumbItems.Insert(0, new BreadcrumbItem { Path = group.Id, Name = group.Title, Icon = group.Icon });
BreadcrumbItems.Add(new BreadcrumbItem { Path = group.Id, Name = group.Title, Icon = group.Icon });
var parentGroup = group;
while (!string.IsNullOrEmpty(parentGroup.ParentGroupId))
{
parentGroup = await _mediator.Send(new GetGroupQuery {Id = parentGroup.ParentGroupId});
BreadcrumbItems.Insert(0, new BreadcrumbItem {Path = parentGroup.Id, Name = parentGroup.Title, Icon = parentGroup.Icon});
BreadcrumbItems.Add(new BreadcrumbItem {Path = parentGroup.Id, Name = parentGroup.Title, Icon = parentGroup.Icon});
}
}