init
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using DTS.Common.Interface.DASFactory;
|
||||
|
||||
namespace DTS.DASLib.Service.StateMachine
|
||||
{
|
||||
public abstract class DASStateSelector : DASState, IDASStateWithSelector
|
||||
{
|
||||
public abstract IDASState StateSelector();
|
||||
}
|
||||
public abstract class DASState : IDASState
|
||||
{
|
||||
public IDASFactory DASFactory { get; set; }
|
||||
public abstract State State { get; }
|
||||
public virtual Action OnEntry { get => OnEnterState; }
|
||||
public virtual Action OnExit { get => OnExitState; }
|
||||
|
||||
public virtual void OnEnterState()
|
||||
{
|
||||
Console.WriteLine($"Enter {State.ToString()} State");
|
||||
}
|
||||
|
||||
public virtual void OnExitState()
|
||||
{
|
||||
Console.WriteLine($"Exit {State.ToString()} State");
|
||||
}
|
||||
/// <summary>
|
||||
/// for now we enforce that there is just one status object
|
||||
/// we'll probably want to refactor this at some point how
|
||||
/// this information is stored and passed, but this will prevent
|
||||
/// accidents from happening in the short term
|
||||
/// </summary>
|
||||
private static readonly Status _status = new Status();
|
||||
|
||||
public Status Status
|
||||
{
|
||||
get => _status;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user