Code refactor and simplfication

ModernKeePassLib assembly info updated and version fixed
This commit is contained in:
2017-10-02 10:44:04 +02:00
committed by BONNEVILLE Geoffroy
parent 6d69dd4d15
commit 30838d0e00
17 changed files with 57 additions and 91 deletions

View File

@@ -0,0 +1,29 @@
using System;
using Windows.UI.Xaml.Controls;
using ModernKeePass.Interfaces;
namespace ModernKeePass.ViewModels
{
public class MainMenuItemVm: IIsEnabled
{
private string _title;
public string Title
{
get { return IsEnabled ? _title : _title + " - Coming soon"; }
set { _title = value; }
}
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 override string ToString()
{
return Title;
}
}
}

View File

@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
using ModernKeePass.Models;
using System.ComponentModel;
using System.Linq;
@@ -7,7 +6,7 @@ namespace ModernKeePass.ViewModels
{
public class MainVm : INotifyPropertyChanged
{
public IOrderedEnumerable<IGrouping<int, MainMenuItem>> MainMenuItems { get; set; }
public IOrderedEnumerable<IGrouping<int, MainMenuItemVm>> MainMenuItems { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string propertyName)

View File

@@ -0,0 +1,19 @@
using System.ComponentModel;
using Windows.UI.Xaml;
namespace ModernKeePass.ViewModels
{
public class RecentItemVm: INotifyPropertyChanged
{
public string Token { get; set; }
public string Name { get; set; }
public Visibility PasswordVisibility { get; set; } = Visibility.Collapsed;
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -1,12 +1,11 @@
using ModernKeePass.Models;
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
using System.ComponentModel;
namespace ModernKeePass.ViewModels
{
public class RecentVm : INotifyPropertyChanged
{
public ObservableCollection<RecentItem> RecentItems { get; set; }
public ObservableCollection<RecentItemVm> RecentItems { get; set; }
public event PropertyChangedEventHandler PropertyChanged;