-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #4 - Added a button to restore the default FOV
- Loading branch information
Showing
4 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Windows.Input; | ||
|
||
namespace JustFOV.Util | ||
{ | ||
public class RelayCommand : ICommand | ||
{ | ||
#region Fields | ||
|
||
readonly Action<object> _execute; | ||
readonly Predicate<object> _canExecute; | ||
|
||
#endregion // Fields | ||
|
||
#region Constructors | ||
|
||
public RelayCommand(Action<object> execute) | ||
: this(execute, null) | ||
{ | ||
} | ||
|
||
public RelayCommand(Action<object> execute, Predicate<object> canExecute) | ||
{ | ||
if (execute == null) | ||
throw new ArgumentNullException("execute"); | ||
|
||
_execute = execute; | ||
_canExecute = canExecute; | ||
} | ||
#endregion // Constructors | ||
|
||
#region ICommand Members | ||
|
||
[DebuggerStepThrough] | ||
public bool CanExecute(object parameter) | ||
{ | ||
return _canExecute == null ? true : _canExecute(parameter); | ||
} | ||
|
||
public event EventHandler CanExecuteChanged | ||
{ | ||
add { CommandManager.RequerySuggested += value; } | ||
remove { CommandManager.RequerySuggested -= value; } | ||
} | ||
|
||
public void Execute(object parameter) | ||
{ | ||
_execute(parameter); | ||
} | ||
|
||
#endregion // ICommand Members | ||
} | ||
} |