26 lines
590 B
C#
26 lines
590 B
C#
using CommandHandler.Commands;
|
|
using CommandHandler.Navigation;
|
|
|
|
namespace CommandHandler;
|
|
|
|
internal class NavigationContext : INavigationContext
|
|
{
|
|
private INavigationState? _navigationState = null;
|
|
|
|
public void SetState(INavigationState navigationState)
|
|
{
|
|
_navigationState = navigationState;
|
|
_navigationState.SetContext(this);
|
|
}
|
|
|
|
public ICommand GetCommand(string message)
|
|
{
|
|
if (_navigationState == null)
|
|
{
|
|
throw new InvalidOperationException();
|
|
}
|
|
|
|
return _navigationState.GetCommand(message);
|
|
}
|
|
}
|