Restored useless changes

Code cleanup
This commit is contained in:
BONNEVILLE Geoffroy
2018-08-03 17:41:52 +02:00
parent 6f96e698ec
commit e437f65f83
7 changed files with 21 additions and 30 deletions

View File

@@ -37,7 +37,7 @@ namespace ModernKeePass.Common
public RelayCommand(Action execute, Func<bool> canExecute) public RelayCommand(Action execute, Func<bool> canExecute)
{ {
if (execute == null) if (execute == null)
throw new ArgumentNullException("execute"); throw new ArgumentNullException(nameof(execute));
_execute = execute; _execute = execute;
_canExecute = canExecute; _canExecute = canExecute;
} }
@@ -72,11 +72,7 @@ namespace ModernKeePass.Common
/// </summary> /// </summary>
public void RaiseCanExecuteChanged() public void RaiseCanExecuteChanged()
{ {
var handler = CanExecuteChanged; CanExecuteChanged?.Invoke(this, EventArgs.Empty);
if (handler != null)
{
handler(this, EventArgs.Empty);
}
} }
} }
} }

View File

@@ -23,7 +23,6 @@ namespace ModernKeePass.Interfaces
/// Restore ViewModel /// Restore ViewModel
/// </summary> /// </summary>
ICommand UndoDeleteCommand { get; } ICommand UndoDeleteCommand { get; }
ICommand GoBackCommand { get; set; }
/// <summary> /// <summary>
/// Move a entity to the destination group /// Move a entity to the destination group
/// </summary> /// </summary>

View File

@@ -197,7 +197,6 @@ namespace ModernKeePass.ViewModels
public ICommand SaveCommand { get; } public ICommand SaveCommand { get; }
public ICommand GeneratePasswordCommand { get; } public ICommand GeneratePasswordCommand { get; }
public ICommand UndoDeleteCommand { get; } public ICommand UndoDeleteCommand { get; }
public ICommand GoBackCommand { get; set; }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;

View File

@@ -118,7 +118,6 @@ namespace ModernKeePass.ViewModels
public ICommand SortEntriesCommand { get; } public ICommand SortEntriesCommand { get; }
public ICommand SortGroupsCommand { get; } public ICommand SortGroupsCommand { get; }
public ICommand UndoDeleteCommand { get; } public ICommand UndoDeleteCommand { get; }
public ICommand GoBackCommand { get; set; }
private readonly PwGroup _pwGroup; private readonly PwGroup _pwGroup;
private readonly IDatabaseService _database; private readonly IDatabaseService _database;

View File

@@ -44,7 +44,6 @@ namespace ModernKeePass.Views
NavigationHelper.OnNavigatedTo(e); NavigationHelper.OnNavigatedTo(e);
if (!(e.Parameter is EntryVm)) return; if (!(e.Parameter is EntryVm)) return;
DataContext = (EntryVm)e.Parameter; DataContext = (EntryVm)e.Parameter;
Model.GoBackCommand = NavigationHelper.GoBackCommand;
} }
protected override void OnNavigatedFrom(NavigationEventArgs e) protected override void OnNavigatedFrom(NavigationEventArgs e)

View File

@@ -56,7 +56,6 @@ namespace ModernKeePass.Views
if (vm != null) if (vm != null)
DataContext = vm; DataContext = vm;
} }
Model.GoBackCommand = NavigationHelper.GoBackCommand;
} }
protected override void OnNavigatedFrom(NavigationEventArgs e) protected override void OnNavigatedFrom(NavigationEventArgs e)

View File

@@ -1,6 +1,6 @@
using System; using System;
using System.Windows.Input;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using ModernKeePass.Common;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 // 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 sealed partial class TopMenuUserControl
{ {
public RelayCommand SaveCommand public ICommand SaveCommand
{ {
get { return (RelayCommand)GetValue(SaveCommandProperty); } get { return (ICommand)GetValue(SaveCommandProperty); }
set { SetValue(SaveCommandProperty, value); } set { SetValue(SaveCommandProperty, value); }
} }
public static readonly DependencyProperty SaveCommandProperty = public static readonly DependencyProperty SaveCommandProperty =
DependencyProperty.Register( DependencyProperty.Register(
"SaveCommand", "SaveCommand",
typeof(RelayCommand), typeof(ICommand),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { })); 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); } set { SetValue(EditCommandProperty, value); }
} }
public static readonly DependencyProperty EditCommandProperty = public static readonly DependencyProperty EditCommandProperty =
DependencyProperty.Register( DependencyProperty.Register(
"EditCommand", "EditCommand",
typeof(RelayCommand), typeof(ICommand),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { })); 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); } set { SetValue(DeleteCommandProperty, value); }
} }
public static readonly DependencyProperty DeleteCommandProperty = public static readonly DependencyProperty DeleteCommandProperty =
DependencyProperty.Register( DependencyProperty.Register(
"DeleteCommand", "DeleteCommand",
typeof(RelayCommand), typeof(ICommand),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { })); 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); } set { SetValue(RestoreCommandProperty, value); }
} }
public static readonly DependencyProperty RestoreCommandProperty = public static readonly DependencyProperty RestoreCommandProperty =
DependencyProperty.Register( DependencyProperty.Register(
"RestoreCommand", "RestoreCommand",
typeof(RelayCommand), typeof(ICommand),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { })); 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); } set { SetValue(SortEntriesCommandProperty, value); }
} }
public static readonly DependencyProperty SortEntriesCommandProperty = public static readonly DependencyProperty SortEntriesCommandProperty =
DependencyProperty.Register( DependencyProperty.Register(
"SortEntriesCommand", "SortEntriesCommand",
typeof(RelayCommand), typeof(ICommand),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { })); 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); } set { SetValue(SortGroupsCommandProperty, value); }
} }
public static readonly DependencyProperty SortGroupsCommandProperty = public static readonly DependencyProperty SortGroupsCommandProperty =
DependencyProperty.Register( DependencyProperty.Register(
"SortGroupsCommand", "SortGroupsCommand",
typeof(RelayCommand), typeof(ICommand),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { })); new PropertyMetadata(null, (o, args) => { }));