mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Corrected Entry password not synchronized bug
Created a new welcome page to be shown on first launch Added descriptive text in main menu pages
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Windows.UI.Text;
|
||||
using System.ComponentModel;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Mappings;
|
||||
@@ -7,7 +7,7 @@ using ModernKeePassLib.Security;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class EntryVm: NotifyPropertyChangedBase
|
||||
public class EntryVm : INotifyPropertyChanged
|
||||
{
|
||||
public GroupVm ParentGroup { get; }
|
||||
public PwEntry Entry { get; }
|
||||
@@ -36,7 +36,11 @@ namespace ModernKeePass.ViewModels
|
||||
public string Password
|
||||
{
|
||||
get { return GetEntryValue(PwDefs.PasswordField); }
|
||||
set { SetEntryValue(PwDefs.PasswordField, value); }
|
||||
set
|
||||
{
|
||||
SetEntryValue(PwDefs.PasswordField, value);
|
||||
NotifyPropertyChanged("Password");
|
||||
}
|
||||
}
|
||||
public string Url
|
||||
{
|
||||
@@ -62,17 +66,31 @@ namespace ModernKeePass.ViewModels
|
||||
public bool IsEditMode
|
||||
{
|
||||
get { return _isEditMode; }
|
||||
set { SetProperty(ref _isEditMode, value); }
|
||||
set
|
||||
{
|
||||
_isEditMode = value;
|
||||
NotifyPropertyChanged("IsEditMode");
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRevealPassword
|
||||
{
|
||||
get { return _isRevealPassword; }
|
||||
set { SetProperty(ref _isRevealPassword, value); }
|
||||
set
|
||||
{
|
||||
_isRevealPassword = value;
|
||||
NotifyPropertyChanged("IsRevealPassword");
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private bool _isEditMode;
|
||||
private bool _isRevealPassword;
|
||||
private void NotifyPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public EntryVm() { }
|
||||
public EntryVm(PwEntry entry, GroupVm parent)
|
||||
|
@@ -7,21 +7,16 @@ namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class MainMenuItemVm: NotifyPropertyChangedBase, IIsEnabled
|
||||
{
|
||||
private string _title;
|
||||
private bool _isSelected;
|
||||
|
||||
public string Title
|
||||
{
|
||||
get { return IsEnabled ? _title : _title + " - Coming soon"; }
|
||||
set { _title = value; }
|
||||
}
|
||||
public string Title { get; set; }
|
||||
|
||||
public Type PageType { get; set; }
|
||||
public object Parameter { get; set; }
|
||||
public Frame Destination { get; set; }
|
||||
public int Group { get; set; } = 0;
|
||||
public Symbol SymbolIcon { get; set; }
|
||||
public bool IsEnabled => PageType != null;
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
|
@@ -45,6 +45,7 @@ namespace ModernKeePass.ViewModels
|
||||
{
|
||||
var app = (App)Application.Current;
|
||||
var mru = StorageApplicationPermissions.MostRecentlyUsedList;
|
||||
var isDatabaseOpen = app.Database != null && app.Database.Status == DatabaseHelper.DatabaseStatus.Opened;
|
||||
|
||||
var mainMenuItems = new ObservableCollection<MainMenuItemVm>
|
||||
{
|
||||
@@ -60,11 +61,11 @@ namespace ModernKeePass.ViewModels
|
||||
new MainMenuItemVm
|
||||
{
|
||||
Title = "Save" , PageType = typeof(SaveDatabasePage), Destination = destinationFrame, Parameter = referenceFrame, SymbolIcon = Symbol.Save,
|
||||
IsSelected = app.Database != null && app.Database.Status == DatabaseHelper.DatabaseStatus.Opened
|
||||
IsSelected = isDatabaseOpen, IsEnabled = isDatabaseOpen
|
||||
},
|
||||
new MainMenuItemVm {
|
||||
Title = "Recent" , PageType = typeof(RecentDatabasesPage), Destination = destinationFrame, Parameter = referenceFrame, SymbolIcon = Symbol.Copy,
|
||||
IsSelected = (app.Database == null || app.Database.Status == DatabaseHelper.DatabaseStatus.Closed) && mru.Entries.Count > 0
|
||||
IsSelected = (app.Database == null || app.Database.Status == DatabaseHelper.DatabaseStatus.Closed) && mru.Entries.Count > 0, IsEnabled = mru.Entries.Count > 0
|
||||
}
|
||||
};
|
||||
// Auto-select the Recent Items menu item if the conditions are met
|
||||
|
@@ -1,34 +1,16 @@
|
||||
using System.ComponentModel;
|
||||
using Windows.Storage;
|
||||
using Windows.Storage;
|
||||
using Windows.UI.Xaml;
|
||||
using ModernKeePass.Common;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class SaveVm: INotifyPropertyChanged
|
||||
public class SaveVm
|
||||
{
|
||||
public bool IsSaveEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
var app = (App)Application.Current;
|
||||
return app.Database.Status == DatabaseHelper.DatabaseStatus.Opened;
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
private void NotifyPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public void Save(bool close = true)
|
||||
{
|
||||
var app = (App)Application.Current;
|
||||
app.Database.Save();
|
||||
if (!close) return;
|
||||
app.Database.Close();
|
||||
NotifyPropertyChanged("IsSaveEnabled");
|
||||
}
|
||||
|
||||
internal void Save(StorageFile file)
|
||||
|
Reference in New Issue
Block a user