mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Handle entities with id
No hierarchy is built anymore WIP save issues after delete
This commit is contained in:
@@ -167,9 +167,9 @@ namespace ModernKeePass
|
||||
|
||||
try
|
||||
{
|
||||
var database = await Mediator.Send(new ReOpenDatabaseQuery());
|
||||
await Mediator.Send(new ReOpenDatabaseQuery());
|
||||
#if DEBUG
|
||||
ToastNotificationHelper.ShowGenericToast(database.Title, "Database reopened (changes were saved)");
|
||||
ToastNotificationHelper.ShowGenericToast("App resumed", "Database reopened (changes were saved)");
|
||||
#endif
|
||||
}
|
||||
catch (Exception)
|
||||
|
@@ -1,15 +1,14 @@
|
||||
using System;
|
||||
using ModernKeePass.Application.Group.Models;
|
||||
|
||||
namespace ModernKeePass.Events
|
||||
{
|
||||
public class PasswordEventArgs: EventArgs
|
||||
{
|
||||
public GroupVm RootGroup { get; set; }
|
||||
public string RootGroupId { get; set; }
|
||||
|
||||
public PasswordEventArgs(GroupVm groupVm)
|
||||
public PasswordEventArgs(string groupId)
|
||||
{
|
||||
RootGroup = groupVm;
|
||||
RootGroupId = groupId;
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,6 +5,7 @@ using Windows.Storage;
|
||||
using Windows.Storage.AccessCache;
|
||||
using MediatR;
|
||||
using ModernKeePass.Application.Database.Commands.UpdateCredentials;
|
||||
using ModernKeePass.Application.Database.Queries.GetDatabase;
|
||||
using ModernKeePass.Application.Database.Queries.OpenDatabase;
|
||||
using ModernKeePass.Application.Security.Commands.GenerateKeyFile;
|
||||
using ModernKeePass.Application.Security.Queries.EstimatePasswordComplexity;
|
||||
@@ -97,7 +98,7 @@ namespace ModernKeePass.ViewModels
|
||||
set { SetProperty(ref _keyFileText, value); }
|
||||
}
|
||||
|
||||
public Application.Group.Models.GroupVm RootGroup { get; set; }
|
||||
public string RootGroupId { get; set; }
|
||||
|
||||
public double PasswordComplexityIndicator => _mediator.Send(new EstimatePasswordComplexityQuery { Password = Password }).GetAwaiter().GetResult();
|
||||
|
||||
@@ -129,11 +130,12 @@ namespace ModernKeePass.ViewModels
|
||||
_isOpening = true;
|
||||
OnPropertyChanged(nameof(IsValid));
|
||||
|
||||
RootGroup = await _mediator.Send(new OpenDatabaseQuery {
|
||||
await _mediator.Send(new OpenDatabaseQuery {
|
||||
FilePath = StorageApplicationPermissions.FutureAccessList.Add(databaseFile),
|
||||
KeyFilePath = HasKeyFile && KeyFile != null ? StorageApplicationPermissions.FutureAccessList.Add(KeyFile) : null,
|
||||
Password = Password = HasPassword ? Password : null,
|
||||
});
|
||||
RootGroupId = (await _mediator.Send(new GetDatabaseQuery())).RootGroupId;
|
||||
return true;
|
||||
}
|
||||
catch (ArgumentException)
|
||||
|
@@ -9,15 +9,19 @@ using ModernKeePass.Application.Database.Commands.SaveDatabase;
|
||||
using ModernKeePass.Application.Database.Models;
|
||||
using ModernKeePass.Application.Database.Queries.GetDatabase;
|
||||
using ModernKeePass.Application.Entry.Commands.SetFieldValue;
|
||||
using ModernKeePass.Application.Entry.Models;
|
||||
using ModernKeePass.Application.Entry.Queries.GetEntry;
|
||||
using ModernKeePass.Application.Group.Commands.AddEntry;
|
||||
using ModernKeePass.Application.Group.Commands.CreateGroup;
|
||||
using ModernKeePass.Application.Group.Commands.DeleteEntry;
|
||||
using ModernKeePass.Application.Group.Commands.RemoveEntry;
|
||||
using ModernKeePass.Application.Group.Queries.GetGroup;
|
||||
using ModernKeePass.Application.Security.Commands.GeneratePassword;
|
||||
using ModernKeePass.Application.Security.Queries.EstimatePasswordComplexity;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Domain.Enums;
|
||||
using ModernKeePass.Domain.Interfaces;
|
||||
using ModernKeePass.Interfaces;
|
||||
using ModernKeePass.Application.Group.Models;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
@@ -37,7 +41,7 @@ namespace ModernKeePass.ViewModels
|
||||
public string CustomChars { get; set; } = string.Empty;
|
||||
public string Id => _entry.Id;
|
||||
|
||||
public IEnumerable<Application.Group.Models.GroupVm> BreadCrumb => _entry.Breadcrumb;
|
||||
public IEnumerable<GroupVm> BreadCrumb => new List<GroupVm> { _parent };
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the Entry is current or from history
|
||||
@@ -174,7 +178,7 @@ namespace ModernKeePass.ViewModels
|
||||
}
|
||||
}
|
||||
}
|
||||
public IEnumerable<Application.Entry.Models.EntryVm> History => _entry.History;
|
||||
public IEnumerable<EntryVm> History => _entry.History;
|
||||
|
||||
public bool IsEditMode
|
||||
{
|
||||
@@ -206,13 +210,14 @@ namespace ModernKeePass.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanRestore => _entry.ParentGroup == _database.RecycleBin;
|
||||
public bool CanRestore => _entry.ParentGroupId == _database.RecycleBinId;
|
||||
|
||||
public ICommand SaveCommand { get; }
|
||||
public ICommand GeneratePasswordCommand { get; }
|
||||
public ICommand UndoDeleteCommand { get; }
|
||||
|
||||
private readonly Application.Entry.Models.EntryVm _entry;
|
||||
private readonly EntryVm _entry;
|
||||
private readonly GroupVm _parent;
|
||||
private readonly IMediator _mediator;
|
||||
private readonly DatabaseVm _database;
|
||||
private bool _isEditMode;
|
||||
@@ -222,19 +227,20 @@ namespace ModernKeePass.ViewModels
|
||||
|
||||
public EntryDetailVm() { }
|
||||
|
||||
internal EntryDetailVm(Application.Entry.Models.EntryVm entry, bool isNewEntry = false) : this(entry, App.Mediator, isNewEntry) { }
|
||||
internal EntryDetailVm(string entryId, bool isNewEntry = false) : this(entryId, App.Mediator, isNewEntry) { }
|
||||
|
||||
public EntryDetailVm(Application.Entry.Models.EntryVm entry, IMediator mediator, bool isNewEntry = false)
|
||||
public EntryDetailVm(string entryId, IMediator mediator, bool isNewEntry = false)
|
||||
{
|
||||
_entry = entry;
|
||||
_mediator = mediator;
|
||||
_database = _mediator.Send(new GetDatabaseQuery()).GetAwaiter().GetResult();
|
||||
_entry = _mediator.Send(new GetEntryQuery {Id = entryId}).GetAwaiter().GetResult();
|
||||
_parent = _mediator.Send(new GetGroupQuery {Id = _entry.ParentGroupId}).GetAwaiter().GetResult();
|
||||
_isEditMode = isNewEntry;
|
||||
if (isNewEntry) GeneratePassword().GetAwaiter().GetResult();
|
||||
|
||||
SaveCommand = new RelayCommand(() => _mediator.Send(new SaveDatabaseCommand()));
|
||||
GeneratePasswordCommand = new RelayCommand(async () => await GeneratePassword());
|
||||
UndoDeleteCommand = new RelayCommand(async () => await Move(entry.ParentGroup), () => _entry.ParentGroup != null);
|
||||
UndoDeleteCommand = new RelayCommand(async () => await Move(_parent), () => _parent != null);
|
||||
}
|
||||
|
||||
public async Task GeneratePassword()
|
||||
@@ -257,18 +263,16 @@ namespace ModernKeePass.ViewModels
|
||||
|
||||
public async Task MarkForDelete(string recycleBinTitle)
|
||||
{
|
||||
if (_database.IsRecycleBinEnabled && _database.RecycleBin == null)
|
||||
_database.RecycleBin = await _mediator.Send(new CreateGroupCommand { ParentGroup = _database.RootGroup, IsRecycleBin = true, Name = recycleBinTitle});
|
||||
await Move(_database.IsRecycleBinEnabled && _entry.ParentGroup != _database.RecycleBin ? _database.RecycleBin : null);
|
||||
await _mediator.Send(new DeleteEntryCommand {EntryId = _entry.Id, ParentGroupId = _entry.ParentGroupId, RecycleBinName = recycleBinTitle});
|
||||
}
|
||||
|
||||
public async Task Move(Application.Group.Models.GroupVm destination)
|
||||
public async Task Move(GroupVm destination)
|
||||
{
|
||||
await _mediator.Send(new AddEntryCommand { ParentGroup = destination, Entry = _entry });
|
||||
await _mediator.Send(new RemoveEntryCommand { ParentGroup = _entry.ParentGroup, Entry = _entry, IsDelete = true });
|
||||
await _mediator.Send(new RemoveEntryCommand { ParentGroup = _parent, Entry = _entry });
|
||||
}
|
||||
|
||||
public Application.Entry.Models.EntryVm GetEntry()
|
||||
public EntryVm GetEntry()
|
||||
{
|
||||
return _entry;
|
||||
}
|
||||
|
@@ -9,15 +9,19 @@ using MediatR;
|
||||
using ModernKeePass.Application.Database.Commands.SaveDatabase;
|
||||
using ModernKeePass.Application.Database.Models;
|
||||
using ModernKeePass.Application.Database.Queries.GetDatabase;
|
||||
using ModernKeePass.Application.Entry.Models;
|
||||
using ModernKeePass.Application.Group.Commands.AddEntry;
|
||||
using ModernKeePass.Application.Group.Commands.AddGroup;
|
||||
using ModernKeePass.Application.Group.Commands.CreateEntry;
|
||||
using ModernKeePass.Application.Group.Commands.CreateGroup;
|
||||
using ModernKeePass.Application.Group.Commands.DeleteGroup;
|
||||
using ModernKeePass.Application.Group.Commands.InsertEntry;
|
||||
using ModernKeePass.Application.Group.Commands.RemoveEntry;
|
||||
using ModernKeePass.Application.Group.Commands.RemoveGroup;
|
||||
using ModernKeePass.Application.Group.Commands.SortEntries;
|
||||
using ModernKeePass.Application.Group.Commands.SortGroups;
|
||||
using ModernKeePass.Application.Group.Models;
|
||||
using ModernKeePass.Application.Group.Queries.GetGroup;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Domain.Enums;
|
||||
using ModernKeePass.Domain.Interfaces;
|
||||
@@ -27,15 +31,15 @@ namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class GroupDetailVm : NotifyPropertyChangedBase, IVmEntity, ISelectableModel
|
||||
{
|
||||
public ObservableCollection<Application.Entry.Models.EntryVm> Entries => new ObservableCollection<Application.Entry.Models.EntryVm>(_group.Entries);
|
||||
public ObservableCollection<EntryVm> Entries => new ObservableCollection<EntryVm>(_group.Entries);
|
||||
|
||||
public ObservableCollection<Application.Group.Models.GroupVm> Groups => new ObservableCollection<Application.Group.Models.GroupVm>(_group.SubGroups);
|
||||
public ObservableCollection<GroupVm> Groups => new ObservableCollection<GroupVm>(_group.SubGroups);
|
||||
|
||||
public IEnumerable<Application.Entry.Models.EntryVm> SubEntries
|
||||
public IEnumerable<EntryVm> SubEntries
|
||||
{
|
||||
get
|
||||
{
|
||||
var subEntries = new List<Application.Entry.Models.EntryVm>();
|
||||
var subEntries = new List<EntryVm>();
|
||||
subEntries.AddRange(Entries);
|
||||
foreach (var group in Groups)
|
||||
{
|
||||
@@ -46,9 +50,9 @@ namespace ModernKeePass.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsNotRoot => _database.RootGroup != _group;
|
||||
public bool IsNotRoot => _database.RootGroupId != _group.Id;
|
||||
|
||||
public bool ShowRestore => IsNotRoot && _database.RecycleBin != _group;
|
||||
public bool ShowRestore => IsNotRoot && _database.RecycleBinId != _group.Id;
|
||||
|
||||
/// <summary>
|
||||
/// Is the Group the database Recycle Bin?
|
||||
@@ -57,15 +61,15 @@ namespace ModernKeePass.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return _database.IsRecycleBinEnabled && _database.RecycleBin == _group;
|
||||
return _database.IsRecycleBinEnabled && _database.RecycleBinId == _group.Id;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value && _group != null) _database.RecycleBin = _group;
|
||||
if (value && _group != null) _database.RecycleBinId = _group.Id;
|
||||
}
|
||||
}
|
||||
|
||||
public IOrderedEnumerable<IGrouping<char, Application.Entry.Models.EntryVm>> EntriesZoomedOut => from e in Entries
|
||||
public IOrderedEnumerable<IGrouping<char, EntryVm>> EntriesZoomedOut => from e in Entries
|
||||
group e by e.Title.ToUpper().FirstOrDefault() into grp
|
||||
orderby grp.Key
|
||||
select grp;
|
||||
@@ -101,30 +105,36 @@ namespace ModernKeePass.ViewModels
|
||||
set { SetProperty(ref _isMenuClosed, value); }
|
||||
}
|
||||
|
||||
public IEnumerable<Application.Group.Models.GroupVm> BreadCrumb => _group.Breadcrumb;
|
||||
public IEnumerable<GroupVm> BreadCrumb { get; }
|
||||
|
||||
public ICommand SaveCommand { get; }
|
||||
public ICommand SortEntriesCommand { get; }
|
||||
public ICommand SortGroupsCommand { get; }
|
||||
public ICommand UndoDeleteCommand { get; }
|
||||
|
||||
private readonly Application.Group.Models.GroupVm _group;
|
||||
private readonly IMediator _mediator;
|
||||
private readonly DatabaseVm _database;
|
||||
private readonly GroupVm _group;
|
||||
private readonly GroupVm _parent;
|
||||
private bool _isEditMode;
|
||||
private Application.Entry.Models.EntryVm _reorderedEntry;
|
||||
private EntryVm _reorderedEntry;
|
||||
private bool _isMenuClosed = true;
|
||||
|
||||
public GroupDetailVm() {}
|
||||
|
||||
internal GroupDetailVm(Application.Group.Models.GroupVm group) : this(group, App.Mediator)
|
||||
internal GroupDetailVm(string groupId) : this(groupId, App.Mediator)
|
||||
{ }
|
||||
|
||||
public GroupDetailVm(Application.Group.Models.GroupVm group, IMediator mediator, bool isEditMode = false)
|
||||
public GroupDetailVm(string groupId, IMediator mediator, bool isEditMode = false)
|
||||
{
|
||||
_group = group;
|
||||
_mediator = mediator;
|
||||
_database = _mediator.Send(new GetDatabaseQuery()).GetAwaiter().GetResult();
|
||||
_group = _mediator.Send(new GetGroupQuery { Id = groupId }).GetAwaiter().GetResult();
|
||||
if (!string.IsNullOrEmpty(_group.ParentGroupId))
|
||||
{
|
||||
_parent = _mediator.Send(new GetGroupQuery { Id = _group.ParentGroupId }).GetAwaiter().GetResult();
|
||||
BreadCrumb = new List<GroupVm> {_parent};
|
||||
}
|
||||
_isEditMode = isEditMode;
|
||||
|
||||
SaveCommand = new RelayCommand(async () => await _mediator.Send(new SaveDatabaseCommand()));
|
||||
@@ -132,7 +142,7 @@ namespace ModernKeePass.ViewModels
|
||||
await SortEntriesAsync().ConfigureAwait(false), () => IsEditMode);
|
||||
SortGroupsCommand = new RelayCommand(async () =>
|
||||
await SortGroupsAsync().ConfigureAwait(false), () => IsEditMode);
|
||||
UndoDeleteCommand = new RelayCommand(async () => await Move(group.ParentGroup), () => _group.ParentGroup != null);
|
||||
UndoDeleteCommand = new RelayCommand(async () => await Move(_parent), () => _parent != null);
|
||||
|
||||
Entries.CollectionChanged += Entries_CollectionChanged;
|
||||
}
|
||||
@@ -160,28 +170,27 @@ namespace ModernKeePass.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Application.Group.Models.GroupVm> AddNewGroup(string name = "")
|
||||
public async Task<string> AddNewGroup(string name = "")
|
||||
{
|
||||
return await _mediator.Send(new CreateGroupCommand {Name = name, ParentGroup = _group});
|
||||
return (await _mediator.Send(new CreateGroupCommand {Name = name, ParentGroup = _group})).Id;
|
||||
}
|
||||
|
||||
public async Task<Application.Entry.Models.EntryVm> AddNewEntry()
|
||||
public async Task<string> AddNewEntry()
|
||||
{
|
||||
return await _mediator.Send(new CreateEntryCommand { ParentGroup = _group });
|
||||
return (await _mediator.Send(new CreateEntryCommand { ParentGroup = _group })).Id;
|
||||
}
|
||||
|
||||
public async Task MarkForDelete(string recycleBinTitle)
|
||||
{
|
||||
if (_database.IsRecycleBinEnabled && _database.RecycleBin == null)
|
||||
_database.RecycleBin = await _mediator.Send(new CreateGroupCommand {ParentGroup = _database.RootGroup, IsRecycleBin = true, Name = recycleBinTitle});
|
||||
await Move(_database.IsRecycleBinEnabled && !IsSelected ? _database.RecycleBin : null);
|
||||
await _mediator.Send(new DeleteGroupCommand { GroupId = _group.Id, ParentGroupId = _group.ParentGroupId, RecycleBinName = recycleBinTitle });
|
||||
|
||||
((RelayCommand)UndoDeleteCommand).RaiseCanExecuteChanged();
|
||||
}
|
||||
|
||||
public async Task Move(Application.Group.Models.GroupVm destination)
|
||||
public async Task Move(GroupVm destination)
|
||||
{
|
||||
await _mediator.Send(new AddGroupCommand {ParentGroup = destination, Group = _group});
|
||||
await _mediator.Send(new RemoveGroupCommand {ParentGroup = _group.ParentGroup, Group = _group, IsDelete = true });
|
||||
await _mediator.Send(new AddGroupCommand {ParentGroup = destination, Group = _group });
|
||||
await _mediator.Send(new RemoveGroupCommand {ParentGroup = _parent, Group = _group });
|
||||
}
|
||||
|
||||
private async Task SortEntriesAsync()
|
||||
|
@@ -4,6 +4,8 @@ using System.Linq;
|
||||
using MediatR;
|
||||
using ModernKeePass.Application.Database.Models;
|
||||
using ModernKeePass.Application.Database.Queries.GetDatabase;
|
||||
using ModernKeePass.Application.Group.Models;
|
||||
using ModernKeePass.Application.Group.Queries.GetGroup;
|
||||
using ModernKeePass.Application.Parameters.Commands.SetCipher;
|
||||
using ModernKeePass.Application.Parameters.Commands.SetCompression;
|
||||
using ModernKeePass.Application.Parameters.Commands.SetHasRecycleBin;
|
||||
@@ -37,14 +39,14 @@ namespace ModernKeePass.ViewModels
|
||||
|
||||
public bool IsNewRecycleBin
|
||||
{
|
||||
get { return _database.RecycleBin == null; }
|
||||
get { return string.IsNullOrEmpty(_database.RecycleBinId); }
|
||||
set
|
||||
{
|
||||
if (value) _mediator.Send(new SetRecycleBinCommand { RecycleBin = null }).Wait();
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<Application.Group.Models.GroupVm> Groups { get; set; }
|
||||
public ObservableCollection<GroupVm> Groups { get; set; }
|
||||
|
||||
public IEnumerable<CipherVm> Ciphers => _mediator.Send(new GetCiphersQuery()).GetAwaiter().GetResult();
|
||||
public IEnumerable<string> Compressions => _mediator.Send(new GetCompressionsQuery()).GetAwaiter().GetResult();
|
||||
@@ -119,7 +121,8 @@ namespace ModernKeePass.ViewModels
|
||||
{
|
||||
_mediator = mediator;
|
||||
_database = _mediator.Send(new GetDatabaseQuery()).GetAwaiter().GetResult();
|
||||
Groups = new ObservableCollection<Application.Group.Models.GroupVm>(_database.RootGroup.SubGroups);
|
||||
var rootGroup = _mediator.Send(new GetGroupQuery { Id = _database.RootGroupId }).GetAwaiter().GetResult();
|
||||
Groups = new ObservableCollection<GroupVm>(rootGroup.SubGroups);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -127,7 +127,7 @@ namespace ModernKeePass.ViewModels
|
||||
Title = database.Name,
|
||||
PageType = typeof(GroupDetailPage),
|
||||
Destination = referenceFrame,
|
||||
Parameter = database.RootGroup,
|
||||
Parameter = database.RootGroupId,
|
||||
Group = "Databases",
|
||||
SymbolIcon = Symbol.ProtectedDocument
|
||||
});
|
||||
|
@@ -5,6 +5,8 @@ using ModernKeePass.Application.Database.Queries.GetDatabase;
|
||||
using ModernKeePass.Application.Entry.Commands.SetFieldValue;
|
||||
using ModernKeePass.Application.Group.Commands.CreateEntry;
|
||||
using ModernKeePass.Application.Group.Commands.CreateGroup;
|
||||
using ModernKeePass.Application.Group.Models;
|
||||
using ModernKeePass.Application.Group.Queries.GetGroup;
|
||||
using ModernKeePass.Domain.Enums;
|
||||
using ModernKeePass.Interfaces;
|
||||
using ModernKeePass.Services;
|
||||
@@ -44,14 +46,15 @@ namespace ModernKeePass.ViewModels
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
public async Task<Application.Group.Models.GroupVm> PopulateInitialData()
|
||||
public async Task<GroupVm> PopulateInitialData()
|
||||
{
|
||||
var database = await _mediator.Send(new GetDatabaseQuery());
|
||||
if (_settings.GetSetting<bool>("Sample") && !IsImportChecked) await CreateSampleData(database.RootGroup);
|
||||
return database.RootGroup;
|
||||
var rootGroup = await _mediator.Send(new GetGroupQuery {Id = database.RootGroupId});
|
||||
if (_settings.GetSetting<bool>("Sample") && !IsImportChecked) await CreateSampleData(rootGroup);
|
||||
return rootGroup;
|
||||
}
|
||||
|
||||
private async Task CreateSampleData(Application.Group.Models.GroupVm group)
|
||||
private async Task CreateSampleData(GroupVm group)
|
||||
{
|
||||
/*var converter = new IntToSymbolConverter();
|
||||
|
||||
|
@@ -42,9 +42,7 @@ namespace ModernKeePass.Views
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
NavigationHelper.OnNavigatedTo(e);
|
||||
/*if (!(e.Parameter is EntryVm)) return;
|
||||
DataContext = (EntryVm)e.Parameter;*/
|
||||
var args = e.Parameter as Application.Entry.Models.EntryVm;
|
||||
var args = e.Parameter as string;
|
||||
if (args != null) DataContext = new EntryDetailVm(args);
|
||||
}
|
||||
|
||||
|
@@ -50,12 +50,12 @@ namespace ModernKeePass.Views
|
||||
|
||||
var args = e.Parameter as PasswordEventArgs;
|
||||
if (args != null)
|
||||
DataContext = new GroupDetailVm(args.RootGroup);
|
||||
DataContext = new GroupDetailVm(args.RootGroupId);
|
||||
else
|
||||
{
|
||||
var vm = e.Parameter as Application.Group.Models.GroupVm;
|
||||
if (vm != null)
|
||||
DataContext = new GroupDetailVm(vm);
|
||||
var id = e.Parameter as string;
|
||||
if (id != null)
|
||||
DataContext = new GroupDetailVm(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace ModernKeePass.Views
|
||||
return;
|
||||
default:
|
||||
var group = listView?.SelectedItem as Application.Group.Models.GroupVm;
|
||||
Frame.Navigate(typeof(GroupDetailPage), group);
|
||||
Frame.Navigate(typeof(GroupDetailPage), group?.Id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ namespace ModernKeePass.Views
|
||||
return;
|
||||
default:
|
||||
var entry = GridView.SelectedItem as EntryVm;
|
||||
Frame.Navigate(typeof(EntryDetailPage), entry);
|
||||
Frame.Navigate(typeof(EntryDetailPage), entry?.Id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ namespace ModernKeePass.Views
|
||||
var results = Model.SubEntries.Where(e => e.Title.IndexOf(args.QueryText, StringComparison.OrdinalIgnoreCase) >= 0).Take(5);
|
||||
foreach (var result in results)
|
||||
{
|
||||
args.Request.SearchSuggestionCollection.AppendResultSuggestion(result.Title, result.ParentGroup.Title, result.Id, imageUri, string.Empty);
|
||||
args.Request.SearchSuggestionCollection.AppendResultSuggestion(result.Title, result.ParentGroupName, result.Id, imageUri, string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
<HyperlinkButton Foreground="{StaticResource MainColor}" Content="{Binding Title}" Style="{StaticResource MainColorHyperlinkButton}" FontWeight="Light" FontSize="12" Padding="0">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="Click">
|
||||
<core:NavigateToPageAction Parameter="{Binding}" TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
||||
<core:NavigateToPageAction Parameter="{Binding Id}" TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</HyperlinkButton>
|
||||
@@ -32,7 +32,7 @@
|
||||
<HyperlinkButton Foreground="{StaticResource MainColor}" Content="{Binding Title}" Style="{StaticResource MainColorHyperlinkButton}" FontWeight="Light" FontSize="12" Padding="0">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="Click">
|
||||
<core:NavigateToPageAction Parameter="{Binding}" TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
||||
<core:NavigateToPageAction Parameter="{Binding Id}" TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</HyperlinkButton>
|
||||
|
@@ -95,7 +95,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
if (UpdateKey)
|
||||
{
|
||||
await Model.UpdateKey();
|
||||
ValidationChecked?.Invoke(this, new PasswordEventArgs(Model.RootGroup));
|
||||
ValidationChecked?.Invoke(this, new PasswordEventArgs(Model.RootGroupId));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -175,7 +175,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
ButtonLabel = resource.GetResourceValue("CompositeKeyOpening");
|
||||
if (await Dispatcher.RunTaskAsync(async () => await Model.OpenDatabase(DatabaseFile, CreateNew)))
|
||||
{
|
||||
ValidationChecked?.Invoke(this, new PasswordEventArgs(Model.RootGroup));
|
||||
ValidationChecked?.Invoke(this, new PasswordEventArgs(Model.RootGroupId));
|
||||
}
|
||||
|
||||
ButtonLabel = oldLabel;
|
||||
|
Reference in New Issue
Block a user