Open/Close AddTournamentModal
This commit is contained in:
24
Apollon.WPF/Commands/CloseModalCommand.cs
Normal file
24
Apollon.WPF/Commands/CloseModalCommand.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Apollon.WPF.Stores;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Apollon.WPF.Commands
|
||||
{
|
||||
public class CloseModalCommand : CommandBase
|
||||
{
|
||||
private readonly ModalNavigationStore _modalNavigationStore;
|
||||
|
||||
public CloseModalCommand(ModalNavigationStore modalNavigationStore)
|
||||
{
|
||||
_modalNavigationStore = modalNavigationStore;
|
||||
}
|
||||
|
||||
public override void Execute(object parameter)
|
||||
{
|
||||
_modalNavigationStore.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Apollon.WPF/Commands/CommandBase.cs
Normal file
26
Apollon.WPF/Commands/CommandBase.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Apollon.WPF.Commands
|
||||
{
|
||||
public abstract class CommandBase : ICommand
|
||||
{
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public virtual bool CanExecute(object parameter)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract void Execute(object parameter);
|
||||
|
||||
protected virtual void OnCanExecutedChanged()
|
||||
{
|
||||
CanExecuteChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Apollon.WPF/Commands/OpenAddTournamentCommand.cs
Normal file
26
Apollon.WPF/Commands/OpenAddTournamentCommand.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Apollon.WPF.Stores;
|
||||
using Apollon.WPF.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Apollon.WPF.Commands
|
||||
{
|
||||
internal class OpenAddTournamentCommand : CommandBase
|
||||
{
|
||||
private readonly ModalNavigationStore _modalNavigationStore;
|
||||
|
||||
public OpenAddTournamentCommand(ModalNavigationStore modalNavigationStore)
|
||||
{
|
||||
_modalNavigationStore = modalNavigationStore;
|
||||
}
|
||||
|
||||
public override void Execute(object parameter)
|
||||
{
|
||||
AddTournametViewModel addTournametViewModel = new AddTournametViewModel(_modalNavigationStore);
|
||||
_modalNavigationStore.CurrentViewModel = addTournametViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user