mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Added the option to close DB without saving
Changed the way recent files are retrieved Stopped showing the DB Closed exception on suspend Reordering entries works Moved code from infra to application Cleanup
This commit is contained in:
@@ -119,7 +119,7 @@
|
|||||||
<Compile Include="Group\Commands\AddGroup\AddGroupCommand.cs" />
|
<Compile Include="Group\Commands\AddGroup\AddGroupCommand.cs" />
|
||||||
<Compile Include="Group\Commands\CreateEntry\CreateEntryCommand.cs" />
|
<Compile Include="Group\Commands\CreateEntry\CreateEntryCommand.cs" />
|
||||||
<Compile Include="Group\Commands\CreateGroup\CreateGroupCommand.cs" />
|
<Compile Include="Group\Commands\CreateGroup\CreateGroupCommand.cs" />
|
||||||
<Compile Include="Group\Commands\InsertEntry\InsertEntryCommand.cs" />
|
<Compile Include="Group\Commands\MoveEntry\MoveEntryCommand.cs" />
|
||||||
<Compile Include="Group\Commands\RemoveEntry\RemoveEntryCommand.cs" />
|
<Compile Include="Group\Commands\RemoveEntry\RemoveEntryCommand.cs" />
|
||||||
<Compile Include="Group\Commands\RemoveGroup\RemoveGroupCommand.cs" />
|
<Compile Include="Group\Commands\RemoveGroup\RemoveGroupCommand.cs" />
|
||||||
<Compile Include="Group\Commands\SortEntries\SortEntriesCommand.cs" />
|
<Compile Include="Group\Commands\SortEntries\SortEntriesCommand.cs" />
|
||||||
|
@@ -27,7 +27,7 @@ namespace ModernKeePass.Application.Common.Interfaces
|
|||||||
void CloseDatabase();
|
void CloseDatabase();
|
||||||
|
|
||||||
Task AddEntry(string parentGroupId, string entryId);
|
Task AddEntry(string parentGroupId, string entryId);
|
||||||
Task InsertEntry(string parentGroupId, string entryId, int index);
|
Task MoveEntry(string parentGroupId, string entryId, int index);
|
||||||
Task AddGroup(string parentGroupId, string groupId);
|
Task AddGroup(string parentGroupId, string groupId);
|
||||||
void UpdateEntry(string entryId, string fieldName, object fieldValue);
|
void UpdateEntry(string entryId, string fieldName, object fieldValue);
|
||||||
void UpdateGroup(string groupId);
|
void UpdateGroup(string groupId);
|
||||||
|
@@ -8,7 +8,7 @@ namespace ModernKeePass.Application.Common.Interfaces
|
|||||||
{
|
{
|
||||||
int EntryCount { get; }
|
int EntryCount { get; }
|
||||||
Task<FileInfo> Get(string token, bool updateAccessTime = false);
|
Task<FileInfo> Get(string token, bool updateAccessTime = false);
|
||||||
Task<IEnumerable<FileInfo>> GetAll();
|
IEnumerable<FileInfo> GetAll();
|
||||||
Task Add(FileInfo recentItem);
|
Task Add(FileInfo recentItem);
|
||||||
void ClearAll();
|
void ClearAll();
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
using MediatR;
|
using MediatR;
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
using ModernKeePass.Application.Database.Models;
|
using ModernKeePass.Application.Database.Models;
|
||||||
|
using ModernKeePass.Domain.Common;
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Database.Queries.GetDatabase
|
namespace ModernKeePass.Application.Database.Queries.GetDatabase
|
||||||
{
|
{
|
||||||
@@ -26,7 +27,7 @@ namespace ModernKeePass.Application.Database.Queries.GetDatabase
|
|||||||
database.Name = _databaseProxy.Name;
|
database.Name = _databaseProxy.Name;
|
||||||
database.RootGroupId = _databaseProxy.RootGroupId;
|
database.RootGroupId = _databaseProxy.RootGroupId;
|
||||||
database.IsRecycleBinEnabled = _databaseProxy.IsRecycleBinEnabled;
|
database.IsRecycleBinEnabled = _databaseProxy.IsRecycleBinEnabled;
|
||||||
database.RecycleBinId = _databaseProxy.RecycleBinId;
|
database.RecycleBinId = _databaseProxy.RecycleBinId == Constants.EmptyId ? null : _databaseProxy.RecycleBinId;
|
||||||
database.Compression = _databaseProxy.Compression;
|
database.Compression = _databaseProxy.Compression;
|
||||||
database.CipherId = _databaseProxy.CipherId;
|
database.CipherId = _databaseProxy.CipherId;
|
||||||
database.KeyDerivationId = _databaseProxy.KeyDerivationId;
|
database.KeyDerivationId = _databaseProxy.KeyDerivationId;
|
||||||
|
@@ -5,28 +5,28 @@ using ModernKeePass.Application.Entry.Models;
|
|||||||
using ModernKeePass.Application.Group.Models;
|
using ModernKeePass.Application.Group.Models;
|
||||||
using ModernKeePass.Domain.Exceptions;
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Group.Commands.InsertEntry
|
namespace ModernKeePass.Application.Group.Commands.MoveEntry
|
||||||
{
|
{
|
||||||
public class InsertEntryCommand : IRequest
|
public class MoveEntryCommand : IRequest
|
||||||
{
|
{
|
||||||
public GroupVm ParentGroup { get; set; }
|
public GroupVm ParentGroup { get; set; }
|
||||||
public EntryVm Entry { get; set; }
|
public EntryVm Entry { get; set; }
|
||||||
public int Index { get; set; }
|
public int Index { get; set; }
|
||||||
|
|
||||||
public class InsertEntryCommandHandler : IAsyncRequestHandler<InsertEntryCommand>
|
public class MoveEntryCommandHandler : IAsyncRequestHandler<MoveEntryCommand>
|
||||||
{
|
{
|
||||||
private readonly IDatabaseProxy _database;
|
private readonly IDatabaseProxy _database;
|
||||||
|
|
||||||
public InsertEntryCommandHandler(IDatabaseProxy database)
|
public MoveEntryCommandHandler(IDatabaseProxy database)
|
||||||
{
|
{
|
||||||
_database = database;
|
_database = database;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Handle(InsertEntryCommand message)
|
public async Task Handle(MoveEntryCommand message)
|
||||||
{
|
{
|
||||||
if (!_database.IsOpen) throw new DatabaseClosedException();
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
|
|
||||||
await _database.InsertEntry(message.ParentGroup.Id, message.Entry.Id, message.Index);
|
await _database.MoveEntry(message.ParentGroup.Id, message.Entry.Id, message.Index);
|
||||||
message.ParentGroup.Entries.Insert(message.Index, message.Entry);
|
message.ParentGroup.Entries.Insert(message.Index, message.Entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,5 +1,6 @@
|
|||||||
using MediatR;
|
using MediatR;
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Domain.Common;
|
||||||
using ModernKeePass.Domain.Exceptions;
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Parameters.Commands.SetRecycleBin
|
namespace ModernKeePass.Application.Parameters.Commands.SetRecycleBin
|
||||||
@@ -19,8 +20,8 @@ namespace ModernKeePass.Application.Parameters.Commands.SetRecycleBin
|
|||||||
|
|
||||||
public void Handle(SetRecycleBinCommand message)
|
public void Handle(SetRecycleBinCommand message)
|
||||||
{
|
{
|
||||||
if (_database.IsOpen) _database.RecycleBinId = message.RecycleBinId;
|
if (!_database.IsOpen) throw new DatabaseClosedException();
|
||||||
else throw new DatabaseClosedException();
|
_database.RecycleBinId = message.RecycleBinId ?? Constants.EmptyId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
ModernKeePass.Domain/Common/Constants.cs
Normal file
7
ModernKeePass.Domain/Common/Constants.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace ModernKeePass.Domain.Common
|
||||||
|
{
|
||||||
|
public static class Constants
|
||||||
|
{
|
||||||
|
public static string EmptyId => "00000000000000000000000000000000";
|
||||||
|
}
|
||||||
|
}
|
@@ -76,6 +76,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AOP\NotifyPropertyChangedBase.cs" />
|
<Compile Include="AOP\NotifyPropertyChangedBase.cs" />
|
||||||
|
<Compile Include="Common\Constants.cs" />
|
||||||
<Compile Include="Dtos\Credentials.cs" />
|
<Compile Include="Dtos\Credentials.cs" />
|
||||||
<Compile Include="Dtos\FileInfo.cs" />
|
<Compile Include="Dtos\FileInfo.cs" />
|
||||||
<Compile Include="Dtos\PasswordGenerationOptions.cs" />
|
<Compile Include="Dtos\PasswordGenerationOptions.cs" />
|
||||||
|
@@ -46,17 +46,12 @@ namespace ModernKeePass.Infrastructure.KeePass
|
|||||||
public string RecycleBinId
|
public string RecycleBinId
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
|
||||||
if (_pwDatabase.RecycleBinEnabled && !_pwDatabase.RecycleBinUuid.Equals(PwUuid.Zero))
|
|
||||||
{
|
{
|
||||||
return _pwDatabase.RecycleBinUuid.ToHexString();
|
return _pwDatabase.RecycleBinUuid.ToHexString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_pwDatabase.RecycleBinUuid = value != null ? BuildIdFromString(value) : PwUuid.Zero;
|
_pwDatabase.RecycleBinUuid = BuildIdFromString(value);
|
||||||
_pwDatabase.RecycleBinChanged = _dateTime.Now;
|
_pwDatabase.RecycleBinChanged = _dateTime.Now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,12 +171,15 @@ namespace ModernKeePass.Infrastructure.KeePass
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task InsertEntry(string parentGroupId, string entryId, int index)
|
public async Task MoveEntry(string parentGroupId, string entryId, int index)
|
||||||
{
|
{
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
var parentPwGroup = _pwDatabase.RootGroup.FindGroup(BuildIdFromString(parentGroupId), true);
|
var parentPwGroup = _pwDatabase.RootGroup.FindGroup(BuildIdFromString(parentGroupId), true);
|
||||||
var pwEntry = _pwDatabase.RootGroup.FindEntry(BuildIdFromString(entryId), true);
|
var pwEntry = _pwDatabase.RootGroup.FindEntry(BuildIdFromString(entryId), true);
|
||||||
|
var currentIndex = (uint)parentPwGroup.Entries.IndexOf(pwEntry);
|
||||||
|
|
||||||
|
parentPwGroup.Entries.RemoveAt(currentIndex);
|
||||||
parentPwGroup.Entries.Insert((uint)index, pwEntry);
|
parentPwGroup.Entries.Insert((uint)index, pwEntry);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -12,15 +12,15 @@ namespace ModernKeePass.Infrastructure.UWP
|
|||||||
{
|
{
|
||||||
public async Task<byte[]> OpenBinaryFile(string path)
|
public async Task<byte[]> OpenBinaryFile(string path)
|
||||||
{
|
{
|
||||||
var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(path);
|
var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(path).AsTask();
|
||||||
var result = await FileIO.ReadBufferAsync(file);
|
var result = await FileIO.ReadBufferAsync(file).AsTask();
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IList<string>> OpenTextFile(string path)
|
public async Task<IList<string>> OpenTextFile(string path)
|
||||||
{
|
{
|
||||||
var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(path);
|
var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(path).AsTask();
|
||||||
var result = await FileIO.ReadLinesAsync(file);
|
var result = await FileIO.ReadLinesAsync(file).AsTask();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,8 +31,8 @@ namespace ModernKeePass.Infrastructure.UWP
|
|||||||
|
|
||||||
public async Task WriteBinaryContentsToFile(string path, byte[] contents)
|
public async Task WriteBinaryContentsToFile(string path, byte[] contents)
|
||||||
{
|
{
|
||||||
var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(path);
|
var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(path).AsTask();
|
||||||
await FileIO.WriteBytesAsync(file, contents);
|
await FileIO.WriteBytesAsync(file, contents).AsTask();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Windows.Storage.AccessCache;
|
using Windows.Storage.AccessCache;
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
@@ -10,13 +11,17 @@ namespace ModernKeePass.Infrastructure.UWP
|
|||||||
public class UwpRecentFilesClient: IRecentProxy
|
public class UwpRecentFilesClient: IRecentProxy
|
||||||
{
|
{
|
||||||
private readonly StorageItemMostRecentlyUsedList _mru = StorageApplicationPermissions.MostRecentlyUsedList;
|
private readonly StorageItemMostRecentlyUsedList _mru = StorageApplicationPermissions.MostRecentlyUsedList;
|
||||||
|
private readonly StorageItemAccessList _fal = StorageApplicationPermissions.FutureAccessList;
|
||||||
|
|
||||||
public int EntryCount => _mru.Entries.Count;
|
public int EntryCount => _mru.Entries.Count;
|
||||||
|
|
||||||
public async Task<FileInfo> Get(string token, bool updateAccessTime = false)
|
public async Task<FileInfo> Get(string token, bool updateAccessTime = false)
|
||||||
{
|
{
|
||||||
var file = await _mru.GetFileAsync(token, updateAccessTime ? AccessCacheOptions.None : AccessCacheOptions.SuppressAccessTimeUpdate);
|
try
|
||||||
StorageApplicationPermissions.FutureAccessList.AddOrReplace(token, file);
|
{
|
||||||
|
var file = await _mru.GetFileAsync(token,
|
||||||
|
updateAccessTime ? AccessCacheOptions.None : AccessCacheOptions.SuppressAccessTimeUpdate).AsTask().ConfigureAwait(false);
|
||||||
|
_fal.AddOrReplace(token, file);
|
||||||
return new FileInfo
|
return new FileInfo
|
||||||
{
|
{
|
||||||
Id = token,
|
Id = token,
|
||||||
@@ -24,37 +29,34 @@ namespace ModernKeePass.Infrastructure.UWP
|
|||||||
Path = file.Path
|
Path = file.Path
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<FileInfo>> GetAll()
|
|
||||||
{
|
|
||||||
var result = new List<FileInfo>();
|
|
||||||
foreach (var entry in _mru.Entries)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var recentItem = await Get(entry.Token);
|
|
||||||
result.Add(recentItem);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
_mru.Remove(entry.Token);
|
_mru.Remove(token);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
|
public IEnumerable<FileInfo> GetAll()
|
||||||
|
{
|
||||||
|
return _mru.Entries.Select(e => new FileInfo
|
||||||
|
{
|
||||||
|
Id = e.Token,
|
||||||
|
Name = e.Metadata?.Substring(e.Metadata.LastIndexOf("\\", StringComparison.OrdinalIgnoreCase) + 1),
|
||||||
|
Path = e.Metadata
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Add(FileInfo recentItem)
|
public async Task Add(FileInfo recentItem)
|
||||||
{
|
{
|
||||||
var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(recentItem.Id);
|
var file = await _fal.GetFileAsync(recentItem.Id).AsTask();
|
||||||
_mru.Add(file);
|
_mru.Add(file, file.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearAll()
|
public void ClearAll()
|
||||||
{
|
{
|
||||||
for (var i = _mru.Entries.Count; i > 0; i--)
|
foreach (var entry in _mru.Entries)
|
||||||
{
|
{
|
||||||
var entry = _mru.Entries[i];
|
if (_fal.ContainsItem(entry.Token)) _fal.Remove(entry.Token);
|
||||||
StorageApplicationPermissions.FutureAccessList.Remove(entry.Token);
|
|
||||||
_mru.Remove(entry.Token);
|
_mru.Remove(entry.Token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,7 @@ namespace ModernKeePass.Actions
|
|||||||
DependencyProperty.Register("Command", typeof(ICommand), typeof(DeleteEntityAction),
|
DependencyProperty.Register("Command", typeof(ICommand), typeof(DeleteEntityAction),
|
||||||
new PropertyMetadata(null));
|
new PropertyMetadata(null));
|
||||||
|
|
||||||
public DeleteEntityAction() : this(App.Services.GetService<IMediator>()) { }
|
public DeleteEntityAction() : this(App.Services.GetRequiredService<IMediator>()) { }
|
||||||
|
|
||||||
public DeleteEntityAction(IMediator mediator)
|
public DeleteEntityAction(IMediator mediator)
|
||||||
{
|
{
|
||||||
@@ -58,7 +58,7 @@ namespace ModernKeePass.Actions
|
|||||||
ToastNotificationHelper.ShowMovedToast(Entity, resource.GetResourceValue("EntityDeleting"), text);
|
ToastNotificationHelper.ShowMovedToast(Entity, resource.GetResourceValue("EntityDeleting"), text);
|
||||||
Entity.MarkForDelete(resource.GetResourceValue("RecycleBinTitle"));
|
Entity.MarkForDelete(resource.GetResourceValue("RecycleBinTitle"));
|
||||||
Command.Execute(null);
|
Command.Execute(null);
|
||||||
}, null).GetAwaiter();
|
}, null).GetAwaiter().GetResult();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -101,7 +101,7 @@ namespace ModernKeePass
|
|||||||
savePicker.FileTypeChoices.Add(_resource.GetResourceValue("MessageDialogSaveErrorFileTypeDesc"),
|
savePicker.FileTypeChoices.Add(_resource.GetResourceValue("MessageDialogSaveErrorFileTypeDesc"),
|
||||||
new List<string> {".kdbx"});
|
new List<string> {".kdbx"});
|
||||||
|
|
||||||
var file = await savePicker.PickSaveFileAsync();
|
var file = await savePicker.PickSaveFileAsync().AsTask();
|
||||||
if (file != null)
|
if (file != null)
|
||||||
{
|
{
|
||||||
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
|
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
|
||||||
@@ -213,15 +213,20 @@ namespace ModernKeePass
|
|||||||
{
|
{
|
||||||
if (_settings.GetSetting("SaveSuspend", true))
|
if (_settings.GetSetting("SaveSuspend", true))
|
||||||
{
|
{
|
||||||
await _mediator.Send(new SaveDatabaseCommand());
|
await _mediator.Send(new SaveDatabaseCommand()).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
await _mediator.Send(new CloseDatabaseCommand());
|
|
||||||
|
await _mediator.Send(new CloseDatabaseCommand()).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (DatabaseClosedException)
|
||||||
|
{
|
||||||
|
// Do nothing on purpose
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
ToastNotificationHelper.ShowErrorToast(exception);
|
ToastNotificationHelper.ShowErrorToast(exception);
|
||||||
}
|
}
|
||||||
await SuspensionManager.SaveAsync();
|
await SuspensionManager.SaveAsync().ConfigureAwait(false);
|
||||||
deferral.Complete();
|
deferral.Complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@ namespace ModernKeePass.Common
|
|||||||
messageDialog.Commands.Add(new UICommand(actionButtonText, actionCommand));
|
messageDialog.Commands.Add(new UICommand(actionButtonText, actionCommand));
|
||||||
|
|
||||||
// Show the message dialog
|
// Show the message dialog
|
||||||
await messageDialog.ShowAsync();
|
await messageDialog.ShowAsync().AsTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task ShowErrorDialog(Exception exception)
|
public static async Task ShowErrorDialog(Exception exception)
|
||||||
@@ -25,7 +25,7 @@ namespace ModernKeePass.Common
|
|||||||
var messageDialog = CreateBasicDialog(exception.Message, exception.StackTrace, "OK");
|
var messageDialog = CreateBasicDialog(exception.Message, exception.StackTrace, "OK");
|
||||||
|
|
||||||
// Show the message dialog
|
// Show the message dialog
|
||||||
await messageDialog.ShowAsync();
|
await messageDialog.ShowAsync().AsTask();;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task ShowNotificationDialog(string title, string message)
|
public static async Task ShowNotificationDialog(string title, string message)
|
||||||
@@ -33,7 +33,7 @@ namespace ModernKeePass.Common
|
|||||||
var dialog = CreateBasicDialog(title, message, "OK");
|
var dialog = CreateBasicDialog(title, message, "OK");
|
||||||
|
|
||||||
// Show the message dialog
|
// Show the message dialog
|
||||||
await dialog.ShowAsync();
|
await dialog.ShowAsync().AsTask();;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MessageDialog CreateBasicDialog(string title, string message, string dismissActionText, UICommandInvokedHandler cancelCommand = null)
|
private static MessageDialog CreateBasicDialog(string title, string message, string dismissActionText, UICommandInvokedHandler cancelCommand = null)
|
||||||
|
@@ -492,4 +492,10 @@
|
|||||||
<data name="NewImportFormat.Text" xml:space="preserve">
|
<data name="NewImportFormat.Text" xml:space="preserve">
|
||||||
<value>Format</value>
|
<value>Format</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="CloseButton.Content" xml:space="preserve">
|
||||||
|
<value>Close without saving</value>
|
||||||
|
</data>
|
||||||
|
<data name="CloseDesc.Text" xml:space="preserve">
|
||||||
|
<value>This will close the currently opened database without saving the changes.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@@ -495,4 +495,10 @@
|
|||||||
<data name="NewImportFormatHelp.Text" xml:space="preserve">
|
<data name="NewImportFormatHelp.Text" xml:space="preserve">
|
||||||
<value>Le fichier CSV doit être formatté de la façon suivante: Nom du compte;Login;Mot de passe:URL;Commentaires</value>
|
<value>Le fichier CSV doit être formatté de la façon suivante: Nom du compte;Login;Mot de passe:URL;Commentaires</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="CloseButton.Content" xml:space="preserve">
|
||||||
|
<value>Fermer sans sauvegarder</value>
|
||||||
|
</data>
|
||||||
|
<data name="CloseDesc.Text" xml:space="preserve">
|
||||||
|
<value>Cela va fermer la base de données ouverte sans sauvegarder les changements.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@@ -115,7 +115,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
private readonly ISettingsProxy _settings;
|
private readonly ISettingsProxy _settings;
|
||||||
private readonly ResourceHelper _resource;
|
private readonly ResourceHelper _resource;
|
||||||
|
|
||||||
public CompositeKeyVm() : this(App.Services.GetService<IMediator>(), App.Services.GetService<ISettingsProxy>()) { }
|
public CompositeKeyVm() : this(App.Services.GetRequiredService<IMediator>(), App.Services.GetRequiredService<ISettingsProxy>()) { }
|
||||||
|
|
||||||
public CompositeKeyVm(IMediator mediator, ISettingsProxy settings)
|
public CompositeKeyVm(IMediator mediator, ISettingsProxy settings)
|
||||||
{
|
{
|
||||||
|
@@ -219,7 +219,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
|
|
||||||
public EntryDetailVm() { }
|
public EntryDetailVm() { }
|
||||||
|
|
||||||
internal EntryDetailVm(string entryId, bool isNewEntry = false) : this(entryId, App.Services.GetService<IMediator>(), isNewEntry) { }
|
internal EntryDetailVm(string entryId, bool isNewEntry = false) : this(entryId, App.Services.GetRequiredService<IMediator>(), isNewEntry) { }
|
||||||
|
|
||||||
public EntryDetailVm(string entryId, IMediator mediator, bool isNewEntry = false)
|
public EntryDetailVm(string entryId, IMediator mediator, bool isNewEntry = false)
|
||||||
{
|
{
|
||||||
@@ -232,7 +232,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
if (isNewEntry) GeneratePassword().GetAwaiter().GetResult();
|
if (isNewEntry) GeneratePassword().GetAwaiter().GetResult();
|
||||||
IsSelected = true;
|
IsSelected = true;
|
||||||
|
|
||||||
SaveCommand = new RelayCommand(() => _mediator.Send(new SaveDatabaseCommand()));
|
SaveCommand = new RelayCommand(async () => await _mediator.Send(new SaveDatabaseCommand()));
|
||||||
GeneratePasswordCommand = new RelayCommand(async () => await GeneratePassword());
|
GeneratePasswordCommand = new RelayCommand(async () => await GeneratePassword());
|
||||||
UndoDeleteCommand = new RelayCommand(async () => await Move(_parent), () => _parent != null);
|
UndoDeleteCommand = new RelayCommand(async () => await Move(_parent), () => _parent != null);
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,7 @@ using ModernKeePass.Application.Group.Commands.AddGroup;
|
|||||||
using ModernKeePass.Application.Group.Commands.CreateEntry;
|
using ModernKeePass.Application.Group.Commands.CreateEntry;
|
||||||
using ModernKeePass.Application.Group.Commands.CreateGroup;
|
using ModernKeePass.Application.Group.Commands.CreateGroup;
|
||||||
using ModernKeePass.Application.Group.Commands.DeleteGroup;
|
using ModernKeePass.Application.Group.Commands.DeleteGroup;
|
||||||
using ModernKeePass.Application.Group.Commands.InsertEntry;
|
using ModernKeePass.Application.Group.Commands.MoveEntry;
|
||||||
using ModernKeePass.Application.Group.Commands.RemoveEntry;
|
|
||||||
using ModernKeePass.Application.Group.Commands.RemoveGroup;
|
using ModernKeePass.Application.Group.Commands.RemoveGroup;
|
||||||
using ModernKeePass.Application.Group.Commands.SortEntries;
|
using ModernKeePass.Application.Group.Commands.SortEntries;
|
||||||
using ModernKeePass.Application.Group.Commands.SortGroups;
|
using ModernKeePass.Application.Group.Commands.SortGroups;
|
||||||
@@ -33,9 +32,9 @@ namespace ModernKeePass.ViewModels
|
|||||||
{
|
{
|
||||||
public class GroupDetailVm : NotifyPropertyChangedBase, IVmEntity, ISelectableModel
|
public class GroupDetailVm : NotifyPropertyChangedBase, IVmEntity, ISelectableModel
|
||||||
{
|
{
|
||||||
public ObservableCollection<EntryVm> Entries => new ObservableCollection<EntryVm>(_group.Entries);
|
public ObservableCollection<EntryVm> Entries { get; }
|
||||||
|
|
||||||
public ObservableCollection<GroupVm> Groups => new ObservableCollection<GroupVm>(_group.SubGroups);
|
public ObservableCollection<GroupVm> Groups { get; }
|
||||||
|
|
||||||
public IEnumerable<EntryVm> SubEntries
|
public IEnumerable<EntryVm> SubEntries
|
||||||
{
|
{
|
||||||
@@ -124,7 +123,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
|
|
||||||
public GroupDetailVm() {}
|
public GroupDetailVm() {}
|
||||||
|
|
||||||
internal GroupDetailVm(string groupId) : this(groupId, App.Services.GetService<IMediator>())
|
internal GroupDetailVm(string groupId) : this(groupId, App.Services.GetRequiredService<IMediator>())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public GroupDetailVm(string groupId, IMediator mediator, bool isEditMode = false)
|
public GroupDetailVm(string groupId, IMediator mediator, bool isEditMode = false)
|
||||||
@@ -141,12 +140,14 @@ namespace ModernKeePass.ViewModels
|
|||||||
|
|
||||||
SaveCommand = new RelayCommand(async () => await _mediator.Send(new SaveDatabaseCommand()));
|
SaveCommand = new RelayCommand(async () => await _mediator.Send(new SaveDatabaseCommand()));
|
||||||
SortEntriesCommand = new RelayCommand(async () =>
|
SortEntriesCommand = new RelayCommand(async () =>
|
||||||
await SortEntriesAsync().ConfigureAwait(false), () => IsEditMode);
|
await SortEntriesAsync(), () => IsEditMode);
|
||||||
SortGroupsCommand = new RelayCommand(async () =>
|
SortGroupsCommand = new RelayCommand(async () =>
|
||||||
await SortGroupsAsync().ConfigureAwait(false), () => IsEditMode);
|
await SortGroupsAsync(), () => IsEditMode);
|
||||||
UndoDeleteCommand = new RelayCommand(async () => await Move(_parent), () => _parent != null);
|
UndoDeleteCommand = new RelayCommand(async () => await Move(_parent), () => _parent != null);
|
||||||
|
|
||||||
|
Entries = new ObservableCollection<EntryVm>(_group.Entries);
|
||||||
Entries.CollectionChanged += Entries_CollectionChanged;
|
Entries.CollectionChanged += Entries_CollectionChanged;
|
||||||
|
Groups = new ObservableCollection<GroupVm>(_group.SubGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Entries_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
private async void Entries_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||||
@@ -156,7 +157,6 @@ namespace ModernKeePass.ViewModels
|
|||||||
case NotifyCollectionChangedAction.Remove:
|
case NotifyCollectionChangedAction.Remove:
|
||||||
var oldIndex = e.OldStartingIndex;
|
var oldIndex = e.OldStartingIndex;
|
||||||
_reorderedEntry = _group.Entries[oldIndex];
|
_reorderedEntry = _group.Entries[oldIndex];
|
||||||
await _mediator.Send(new RemoveEntryCommand {Entry = _reorderedEntry, ParentGroup = _group});
|
|
||||||
break;
|
break;
|
||||||
case NotifyCollectionChangedAction.Add:
|
case NotifyCollectionChangedAction.Add:
|
||||||
if (_reorderedEntry == null)
|
if (_reorderedEntry == null)
|
||||||
@@ -166,7 +166,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await _mediator.Send(new InsertEntryCommand {Entry = _reorderedEntry, ParentGroup = _group, Index = e.NewStartingIndex});
|
await _mediator.Send(new MoveEntryCommand {Entry = _reorderedEntry, ParentGroup = _group, Index = e.NewStartingIndex});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
set { SetProperty(ref _isSelected, value); }
|
set { SetProperty(ref _isSelected, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecentItemVm(FileInfo file): this(App.Services.GetService<IRecentProxy>(), file) {}
|
public RecentItemVm(FileInfo file): this(App.Services.GetRequiredService<IRecentProxy>(), file) {}
|
||||||
public RecentItemVm(IRecentProxy recent, FileInfo file)
|
public RecentItemVm(IRecentProxy recent, FileInfo file)
|
||||||
{
|
{
|
||||||
_recent = recent;
|
_recent = recent;
|
||||||
|
@@ -77,7 +77,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SettingsDatabaseVm() : this(App.Services.GetService<IMediator>()) { }
|
public SettingsDatabaseVm() : this(App.Services.GetRequiredService<IMediator>()) { }
|
||||||
|
|
||||||
public SettingsDatabaseVm(IMediator mediator)
|
public SettingsDatabaseVm(IMediator mediator)
|
||||||
{
|
{
|
||||||
|
@@ -8,7 +8,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
{
|
{
|
||||||
private readonly ISettingsProxy _settings;
|
private readonly ISettingsProxy _settings;
|
||||||
|
|
||||||
public SettingsNewVm() : this(App.Services.GetService<ISettingsProxy>())
|
public SettingsNewVm() : this(App.Services.GetRequiredService<ISettingsProxy>())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public SettingsNewVm(ISettingsProxy settings)
|
public SettingsNewVm(ISettingsProxy settings)
|
||||||
|
@@ -7,7 +7,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
{
|
{
|
||||||
private readonly ISettingsProxy _settings;
|
private readonly ISettingsProxy _settings;
|
||||||
|
|
||||||
public SettingsSaveVm() : this(App.Services.GetService<ISettingsProxy>())
|
public SettingsSaveVm() : this(App.Services.GetRequiredService<ISettingsProxy>())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public SettingsSaveVm(ISettingsProxy settings)
|
public SettingsSaveVm(ISettingsProxy settings)
|
||||||
|
@@ -50,7 +50,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
public MainVm() {}
|
public MainVm() {}
|
||||||
|
|
||||||
internal MainVm(Frame referenceFrame, Frame destinationFrame, FileInfo databaseFile = null) : this(referenceFrame, destinationFrame,
|
internal MainVm(Frame referenceFrame, Frame destinationFrame, FileInfo databaseFile = null) : this(referenceFrame, destinationFrame,
|
||||||
App.Services.GetService<IMediator>(), App.Services.GetService<IRecentProxy>(), databaseFile)
|
App.Services.GetRequiredService<IMediator>(), App.Services.GetRequiredService<IRecentProxy>(), databaseFile)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public MainVm(Frame referenceFrame, Frame destinationFrame, IMediator mediator, IRecentProxy recent, FileInfo databaseFile = null)
|
public MainVm(Frame referenceFrame, Frame destinationFrame, IMediator mediator, IRecentProxy recent, FileInfo databaseFile = null)
|
||||||
|
@@ -32,7 +32,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
private set { SetProperty(ref _path, value); }
|
private set { SetProperty(ref _path, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public OpenVm(): this(App.Services.GetService<IRecentProxy>()) { }
|
public OpenVm(): this(App.Services.GetRequiredService<IRecentProxy>()) { }
|
||||||
|
|
||||||
public OpenVm(IRecentProxy recent)
|
public OpenVm(IRecentProxy recent)
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
@@ -41,7 +42,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
|
|
||||||
public ICommand ClearAllCommand { get; }
|
public ICommand ClearAllCommand { get; }
|
||||||
|
|
||||||
public RecentVm() : this (App.Services.GetService<IRecentProxy>())
|
public RecentVm() : this (App.Services.GetRequiredService<IRecentProxy>())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public RecentVm(IRecentProxy recent)
|
public RecentVm(IRecentProxy recent)
|
||||||
@@ -49,7 +50,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
_recent = recent;
|
_recent = recent;
|
||||||
ClearAllCommand = new RelayCommand(ClearAll);
|
ClearAllCommand = new RelayCommand(ClearAll);
|
||||||
|
|
||||||
var recentItems = _recent.GetAll().GetAwaiter().GetResult().Select(r => new RecentItemVm(r));
|
var recentItems = _recent.GetAll().Select(r => new RecentItemVm(r));
|
||||||
RecentItems = new ObservableCollection<RecentItemVm>(recentItems);
|
RecentItems = new ObservableCollection<RecentItemVm>(recentItems);
|
||||||
if (RecentItems.Count > 0)
|
if (RecentItems.Count > 0)
|
||||||
SelectedItem = RecentItems[0];
|
SelectedItem = RecentItems[0];
|
||||||
|
@@ -11,7 +11,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
public class SaveVm
|
public class SaveVm
|
||||||
{
|
{
|
||||||
private readonly IMediator _mediator;
|
private readonly IMediator _mediator;
|
||||||
public SaveVm() : this(App.Services.GetService<IMediator>()) { }
|
public SaveVm() : this(App.Services.GetRequiredService<IMediator>()) { }
|
||||||
|
|
||||||
public SaveVm(IMediator mediator)
|
public SaveVm(IMediator mediator)
|
||||||
{
|
{
|
||||||
@@ -21,7 +21,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
public async Task Save(bool close = true)
|
public async Task Save(bool close = true)
|
||||||
{
|
{
|
||||||
await _mediator.Send(new SaveDatabaseCommand());
|
await _mediator.Send(new SaveDatabaseCommand());
|
||||||
if (close) await _mediator.Send(new CloseDatabaseCommand());
|
if (close) await Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Save(StorageFile file)
|
public async Task Save(StorageFile file)
|
||||||
@@ -29,5 +29,10 @@ namespace ModernKeePass.ViewModels
|
|||||||
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
|
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
|
||||||
await _mediator.Send(new SaveDatabaseCommand { FilePath = token });
|
await _mediator.Send(new SaveDatabaseCommand { FilePath = token });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task Close()
|
||||||
|
{
|
||||||
|
await _mediator.Send(new CloseDatabaseCommand());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -43,7 +43,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SettingsVm() : this(App.Services.GetService<IMediator>()) { }
|
public SettingsVm() : this(App.Services.GetRequiredService<IMediator>()) { }
|
||||||
|
|
||||||
public SettingsVm(IMediator mediator)
|
public SettingsVm(IMediator mediator)
|
||||||
{
|
{
|
||||||
|
@@ -27,7 +27,7 @@ namespace ModernKeePass.Views
|
|||||||
picker.FileTypeFilter.Add(".csv");
|
picker.FileTypeFilter.Add(".csv");
|
||||||
|
|
||||||
// Application now has read/write access to the picked file
|
// Application now has read/write access to the picked file
|
||||||
var file = await picker.PickSingleFileAsync();
|
var file = await picker.PickSingleFileAsync().AsTask();
|
||||||
if (file == null) return;
|
if (file == null) return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,7 @@ namespace ModernKeePass.Views
|
|||||||
};
|
};
|
||||||
savePicker.FileTypeChoices.Add("KeePass 2.x database", new List<string> { ".kdbx" });
|
savePicker.FileTypeChoices.Add("KeePass 2.x database", new List<string> { ".kdbx" });
|
||||||
|
|
||||||
var file = await savePicker.PickSaveFileAsync();
|
var file = await savePicker.PickSaveFileAsync().AsTask();
|
||||||
if (file == null) return;
|
if (file == null) return;
|
||||||
|
|
||||||
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
|
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
|
||||||
@@ -72,7 +72,7 @@ namespace ModernKeePass.Views
|
|||||||
picker.FileTypeFilter.Add(Model.ImportFileExtensionFilter);
|
picker.FileTypeFilter.Add(Model.ImportFileExtensionFilter);
|
||||||
|
|
||||||
// Application now has read/write access to the picked file
|
// Application now has read/write access to the picked file
|
||||||
Model.ImportFile = await picker.PickSingleFileAsync();
|
Model.ImportFile = await picker.PickSingleFileAsync().AsTask();
|
||||||
if (Model.ImportFile != null) ImportFileLink.Content = Model.ImportFile.Name;
|
if (Model.ImportFile != null) ImportFileLink.Content = Model.ImportFile.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ namespace ModernKeePass.Views
|
|||||||
picker.FileTypeFilter.Add(".kdbx");
|
picker.FileTypeFilter.Add(".kdbx");
|
||||||
|
|
||||||
// Application now has read/write access to the picked file
|
// Application now has read/write access to the picked file
|
||||||
var file = await picker.PickSingleFileAsync();
|
var file = await picker.PickSingleFileAsync().AsTask();
|
||||||
if (file == null) return;
|
if (file == null) return;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -12,12 +12,10 @@
|
|||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<Page.Resources>
|
<Page.Resources>
|
||||||
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||||
<CollectionViewSource x:Name="RecentItemsSource" Source="{Binding RecentItems}" />
|
<viewModels:RecentVm x:Key="ViewModel"/>
|
||||||
|
<!--<CollectionViewSource x:Name="RecentItemsSource" Source="{Binding RecentItems}" />-->
|
||||||
</Page.Resources>
|
</Page.Resources>
|
||||||
<Page.DataContext>
|
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}" DataContext="{StaticResource ViewModel}">
|
||||||
<viewModels:RecentVm/>
|
|
||||||
</Page.DataContext>
|
|
||||||
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="40" />
|
<RowDefinition Height="40" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
@@ -29,7 +27,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</HyperlinkButton>
|
</HyperlinkButton>
|
||||||
<ListView Grid.Row="1"
|
<ListView Grid.Row="1"
|
||||||
ItemsSource="{Binding Source={StaticResource RecentItemsSource}}"
|
ItemsSource="{Binding RecentItems}"
|
||||||
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
|
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
|
||||||
ItemContainerStyle="{StaticResource ListViewLeftIndicatorItemExpanded}">
|
ItemContainerStyle="{StaticResource ListViewLeftIndicatorItemExpanded}">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
@@ -47,8 +45,10 @@
|
|||||||
<TextBlock Grid.Row="1" Text="{Binding Path}" Padding="5,0,0,0" FontSize="10" />
|
<TextBlock Grid.Row="1" Text="{Binding Path}" Padding="5,0,0,0" FontSize="10" />
|
||||||
<userControls:CompositeKeyUserControl Grid.Row="2" x:Name="DatabaseUserControl" x:Uid="CompositeKeyOpenButton" HorizontalAlignment="Stretch" MinWidth="400" Margin="0,10,0,0" Visibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}" DatabaseFilePath="{Binding Token}">
|
<userControls:CompositeKeyUserControl Grid.Row="2" x:Name="DatabaseUserControl" x:Uid="CompositeKeyOpenButton" HorizontalAlignment="Stretch" MinWidth="400" Margin="0,10,0,0" Visibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}" DatabaseFilePath="{Binding Token}">
|
||||||
<interactivity:Interaction.Behaviors>
|
<interactivity:Interaction.Behaviors>
|
||||||
<core:EventTriggerBehavior EventName="ValidationChecked">
|
<core:EventTriggerBehavior EventName="ValidationChecking">
|
||||||
<core:CallMethodAction TargetObject="{Binding}" MethodName="UpdateAccessTime" />
|
<core:CallMethodAction TargetObject="{Binding}" MethodName="UpdateAccessTime" />
|
||||||
|
</core:EventTriggerBehavior>
|
||||||
|
<core:EventTriggerBehavior EventName="ValidationChecked">
|
||||||
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
||||||
</core:EventTriggerBehavior>
|
</core:EventTriggerBehavior>
|
||||||
</interactivity:Interaction.Behaviors>
|
</interactivity:Interaction.Behaviors>
|
||||||
|
@@ -15,5 +15,7 @@
|
|||||||
<TextBlock x:Uid="SaveDesc" Style="{StaticResource BodyTextBlockStyle}" Margin="15,0,0,30" />
|
<TextBlock x:Uid="SaveDesc" Style="{StaticResource BodyTextBlockStyle}" Margin="15,0,0,30" />
|
||||||
<HyperlinkButton x:Uid="SaveAsButton" Click="SaveAsButton_OnClick" Foreground="{StaticResource MainColor}" Style="{StaticResource MainColorHyperlinkButton}" />
|
<HyperlinkButton x:Uid="SaveAsButton" Click="SaveAsButton_OnClick" Foreground="{StaticResource MainColor}" Style="{StaticResource MainColorHyperlinkButton}" />
|
||||||
<TextBlock x:Uid="SaveAsDesc" Style="{StaticResource BodyTextBlockStyle}" Margin="15,0,0,30" />
|
<TextBlock x:Uid="SaveAsDesc" Style="{StaticResource BodyTextBlockStyle}" Margin="15,0,0,30" />
|
||||||
|
<HyperlinkButton x:Uid="CloseButton" Click="CloseButton_OnClick" Foreground="{StaticResource MainColor}" Style="{StaticResource MainColorHyperlinkButton}" />
|
||||||
|
<TextBlock x:Uid="CloseDesc" Style="{StaticResource BodyTextBlockStyle}" Margin="15,0,0,30" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Page>
|
</Page>
|
||||||
|
@@ -43,11 +43,17 @@ namespace ModernKeePass.Views
|
|||||||
};
|
};
|
||||||
savePicker.FileTypeChoices.Add("KeePass 2.x database", new List<string> { ".kdbx" });
|
savePicker.FileTypeChoices.Add("KeePass 2.x database", new List<string> { ".kdbx" });
|
||||||
|
|
||||||
var file = await savePicker.PickSaveFileAsync();
|
var file = await savePicker.PickSaveFileAsync().AsTask();
|
||||||
if (file == null) return;
|
if (file == null) return;
|
||||||
await Model.Save(file);
|
await Model.Save(file);
|
||||||
|
|
||||||
_mainFrame.Navigate(typeof(MainPage));
|
_mainFrame.Navigate(typeof(MainPage));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void CloseButton_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
await Model.Close();
|
||||||
|
_mainFrame.Navigate(typeof(MainPage));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -77,7 +77,7 @@ namespace ModernKeePass.Views.UserControls
|
|||||||
|
|
||||||
public bool ShowComplexityIndicator => CreateNew || UpdateKey;
|
public bool ShowComplexityIndicator => CreateNew || UpdateKey;
|
||||||
|
|
||||||
public CompositeKeyUserControl(): this(App.Services.GetService<IMediator>())
|
public CompositeKeyUserControl(): this(App.Services.GetRequiredService<IMediator>())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public CompositeKeyUserControl(IMediator mediator)
|
public CompositeKeyUserControl(IMediator mediator)
|
||||||
|
Reference in New Issue
Block a user