Replaced almost all CallMethodActions with RelayCommands (allows using async)

SonarQube bug correction
This commit is contained in:
BONNEVILLE Geoffroy
2018-06-20 18:41:56 +02:00
parent ca377a6684
commit 803dab0fb5
8 changed files with 87 additions and 108 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.ObjectModel;
using System.Windows.Input;
using ModernKeePass.Common;
using ModernKeePass.Interfaces;
using ModernKeePass.Services;
@@ -34,6 +35,8 @@ namespace ModernKeePass.ViewModels
_selectedItem.IsSelected = true;
}
}
public ICommand ClearAllCommand { get; }
public RecentVm() : this (RecentService.Instance)
{ }
@@ -41,12 +44,14 @@ namespace ModernKeePass.ViewModels
public RecentVm(IRecentService recent)
{
_recent = recent;
ClearAllCommand = new RelayCommand(ClearAll);
RecentItems = _recent.GetAllFiles();
if (RecentItems.Count > 0)
SelectedItem = RecentItems[0] as RecentItemVm;
}
public void ClearAll()
private void ClearAll()
{
_recent.ClearAll();
RecentItems.Clear();