diff --git a/App.xaml b/App.xaml index 2ddacc2..a1cbdcc 100644 --- a/App.xaml +++ b/App.xaml @@ -2,8 +2,52 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Libertix" + xmlns:converters="clr-namespace:Libertix.Converters" StartupUri="MainWindow.xaml"> - + + + + + + + + + + + + + + + + + diff --git a/Commands/RelayCommand.cs b/Commands/RelayCommand.cs new file mode 100644 index 0000000..2f23f19 --- /dev/null +++ b/Commands/RelayCommand.cs @@ -0,0 +1,27 @@ +using System; +using System.Windows.Input; + +namespace Libertix.Commands +{ + public class RelayCommand : ICommand + { + private readonly Action _execute; + private readonly Func _canExecute; + + public RelayCommand(Action execute, Func canExecute = null) + { + _execute = execute ?? throw new ArgumentNullException(nameof(execute)); + _canExecute = canExecute; + } + + public event EventHandler CanExecuteChanged + { + add { CommandManager.RequerySuggested += value; } + remove { CommandManager.RequerySuggested -= value; } + } + + public bool CanExecute(object parameter) => _canExecute?.Invoke(parameter) ?? true; + + public void Execute(object parameter) => _execute(parameter); + } +} diff --git a/Controls/ErrorPanel.xaml b/Controls/ErrorPanel.xaml new file mode 100644 index 0000000..246bf58 --- /dev/null +++ b/Controls/ErrorPanel.xaml @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +