public static StateMachine<CreditRequest> Create(CreditRequest request) { var provider = new ScanningStateProvider<CreditRequest>(); var config = new MachineConfiguration<CreditRequest>(); config.OnStateChange( reset: (sender, args) => args.Switches.State = args.Next.GetType(), enter: (sender, args) => args.Switches.State = args.Next.GetType() ); var machine = new StateMachine<CreditRequest>(config, provider, request); machine.ResetTo(request.State); return machine; }
public NewRequestPresenter(INewRequestView view) { _view = view; _view.SaveRequest += OnSaveRequest; _view.SubmitRequest += OnSubmitRequest; _view.CancelRequest += OnCancelRequest; CreditRequest = new CreditRequest { ID = Guid.NewGuid(), CreatedOn = DateTime.Now, CreatedBy = ClaimsPrincipal.Current.Identity.Name, State = typeof(NewRequest) }; _fsm = StateMachineBuilder.Create(CreditRequest); }
public CreditRequestViewModel(CreditRequest request) { Request = request; }
public void DisplayRequest(CreditRequest request) { lblTitle.Text = $"User {request.CreatedBy} requests £{request.Amount}"; txtJustification.Text = request.Justification; }