Example #1
0
        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;
        }
Example #2
0
        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);
        }
Example #3
0
 public CreditRequestViewModel(CreditRequest request)
 {
     Request = request;
 }
Example #4
0
 public void DisplayRequest(CreditRequest request)
 {
     lblTitle.Text = $"User {request.CreatedBy} requests £{request.Amount}";
     txtJustification.Text = request.Justification;
 }