diff --git a/ModernKeePass/Common/RelayCommand.cs b/ModernKeePass/Common/RelayCommand.cs index 232f4cf..b651858 100644 --- a/ModernKeePass/Common/RelayCommand.cs +++ b/ModernKeePass/Common/RelayCommand.cs @@ -37,7 +37,7 @@ namespace ModernKeePass.Common public RelayCommand(Action execute, Func canExecute) { if (execute == null) - throw new ArgumentNullException("execute"); + throw new ArgumentNullException(nameof(execute)); _execute = execute; _canExecute = canExecute; } @@ -72,11 +72,7 @@ namespace ModernKeePass.Common /// public void RaiseCanExecuteChanged() { - var handler = CanExecuteChanged; - if (handler != null) - { - handler(this, EventArgs.Empty); - } + CanExecuteChanged?.Invoke(this, EventArgs.Empty); } } } \ No newline at end of file diff --git a/ModernKeePass/Interfaces/IPwEntity.cs b/ModernKeePass/Interfaces/IPwEntity.cs index 90f1891..f4045a7 100644 --- a/ModernKeePass/Interfaces/IPwEntity.cs +++ b/ModernKeePass/Interfaces/IPwEntity.cs @@ -23,7 +23,6 @@ namespace ModernKeePass.Interfaces /// Restore ViewModel /// ICommand UndoDeleteCommand { get; } - ICommand GoBackCommand { get; set; } /// /// Move a entity to the destination group /// diff --git a/ModernKeePass/ViewModels/EntryVm.cs b/ModernKeePass/ViewModels/EntryVm.cs index 034c90f..a4765a3 100644 --- a/ModernKeePass/ViewModels/EntryVm.cs +++ b/ModernKeePass/ViewModels/EntryVm.cs @@ -197,7 +197,6 @@ namespace ModernKeePass.ViewModels public ICommand SaveCommand { get; } public ICommand GeneratePasswordCommand { get; } public ICommand UndoDeleteCommand { get; } - public ICommand GoBackCommand { get; set; } public event PropertyChangedEventHandler PropertyChanged; diff --git a/ModernKeePass/ViewModels/GroupVm.cs b/ModernKeePass/ViewModels/GroupVm.cs index f47a902..99e2940 100644 --- a/ModernKeePass/ViewModels/GroupVm.cs +++ b/ModernKeePass/ViewModels/GroupVm.cs @@ -118,7 +118,6 @@ namespace ModernKeePass.ViewModels public ICommand SortEntriesCommand { get; } public ICommand SortGroupsCommand { get; } public ICommand UndoDeleteCommand { get; } - public ICommand GoBackCommand { get; set; } private readonly PwGroup _pwGroup; private readonly IDatabaseService _database; diff --git a/ModernKeePass/Views/EntryDetailPage.xaml.cs b/ModernKeePass/Views/EntryDetailPage.xaml.cs index e81e233..8a69662 100644 --- a/ModernKeePass/Views/EntryDetailPage.xaml.cs +++ b/ModernKeePass/Views/EntryDetailPage.xaml.cs @@ -44,7 +44,6 @@ namespace ModernKeePass.Views NavigationHelper.OnNavigatedTo(e); if (!(e.Parameter is EntryVm)) return; DataContext = (EntryVm)e.Parameter; - Model.GoBackCommand = NavigationHelper.GoBackCommand; } protected override void OnNavigatedFrom(NavigationEventArgs e) diff --git a/ModernKeePass/Views/GroupDetailPage.xaml.cs b/ModernKeePass/Views/GroupDetailPage.xaml.cs index e239a92..d4fde98 100644 --- a/ModernKeePass/Views/GroupDetailPage.xaml.cs +++ b/ModernKeePass/Views/GroupDetailPage.xaml.cs @@ -56,7 +56,6 @@ namespace ModernKeePass.Views if (vm != null) DataContext = vm; } - Model.GoBackCommand = NavigationHelper.GoBackCommand; } protected override void OnNavigatedFrom(NavigationEventArgs e) diff --git a/ModernKeePass/Views/UserControls/TopMenuUserControl.xaml.cs b/ModernKeePass/Views/UserControls/TopMenuUserControl.xaml.cs index 5170128..2c1b0b5 100644 --- a/ModernKeePass/Views/UserControls/TopMenuUserControl.xaml.cs +++ b/ModernKeePass/Views/UserControls/TopMenuUserControl.xaml.cs @@ -1,6 +1,6 @@ using System; +using System.Windows.Input; using Windows.UI.Xaml; -using ModernKeePass.Common; // The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 @@ -8,75 +8,75 @@ namespace ModernKeePass.Views.UserControls { public sealed partial class TopMenuUserControl { - public RelayCommand SaveCommand + public ICommand SaveCommand { - get { return (RelayCommand)GetValue(SaveCommandProperty); } + get { return (ICommand)GetValue(SaveCommandProperty); } set { SetValue(SaveCommandProperty, value); } } public static readonly DependencyProperty SaveCommandProperty = DependencyProperty.Register( "SaveCommand", - typeof(RelayCommand), + typeof(ICommand), typeof(TopMenuUserControl), new PropertyMetadata(null, (o, args) => { })); - public RelayCommand EditCommand + public ICommand EditCommand { - get { return (RelayCommand)GetValue(EditCommandProperty); } + get { return (ICommand)GetValue(EditCommandProperty); } set { SetValue(EditCommandProperty, value); } } public static readonly DependencyProperty EditCommandProperty = DependencyProperty.Register( "EditCommand", - typeof(RelayCommand), + typeof(ICommand), typeof(TopMenuUserControl), new PropertyMetadata(null, (o, args) => { })); - public RelayCommand DeleteCommand + public ICommand DeleteCommand { - get { return (RelayCommand)GetValue(DeleteCommandProperty); } + get { return (ICommand)GetValue(DeleteCommandProperty); } set { SetValue(DeleteCommandProperty, value); } } public static readonly DependencyProperty DeleteCommandProperty = DependencyProperty.Register( "DeleteCommand", - typeof(RelayCommand), + typeof(ICommand), typeof(TopMenuUserControl), new PropertyMetadata(null, (o, args) => { })); - public RelayCommand RestoreCommand + public ICommand RestoreCommand { - get { return (RelayCommand)GetValue(RestoreCommandProperty); } + get { return (ICommand)GetValue(RestoreCommandProperty); } set { SetValue(RestoreCommandProperty, value); } } public static readonly DependencyProperty RestoreCommandProperty = DependencyProperty.Register( "RestoreCommand", - typeof(RelayCommand), + typeof(ICommand), typeof(TopMenuUserControl), new PropertyMetadata(null, (o, args) => { })); - public RelayCommand SortEntriesCommand + public ICommand SortEntriesCommand { - get { return (RelayCommand)GetValue(SortEntriesCommandProperty); } + get { return (ICommand)GetValue(SortEntriesCommandProperty); } set { SetValue(SortEntriesCommandProperty, value); } } public static readonly DependencyProperty SortEntriesCommandProperty = DependencyProperty.Register( "SortEntriesCommand", - typeof(RelayCommand), + typeof(ICommand), typeof(TopMenuUserControl), new PropertyMetadata(null, (o, args) => { })); - public RelayCommand SortGroupsCommand + public ICommand SortGroupsCommand { - get { return (RelayCommand)GetValue(SortGroupsCommandProperty); } + get { return (ICommand)GetValue(SortGroupsCommandProperty); } set { SetValue(SortGroupsCommandProperty, value); } } public static readonly DependencyProperty SortGroupsCommandProperty = DependencyProperty.Register( "SortGroupsCommand", - typeof(RelayCommand), + typeof(ICommand), typeof(TopMenuUserControl), new PropertyMetadata(null, (o, args) => { }));