예제 #1
0
        internal void InitialiseStateMachine()
        {
            if (_restClient.MobileDevice != null)
            {
                StateMachine = new ActivationStateMachine(_restClient, _logger);

                var hasState = StateMachine.LoadPersistedState();

                // if we are not in the initial state
                if (hasState && (StateMachine.CurrentState is ActivationStateMachine.NotActivated == false))
                {
                    var device = _restClient.Device;
                    if (device.Id.IsEmpty() || device.DeviceSecret.IsEmpty())
                    {
                        _logger.Warning("State machine has loaded state but failed to load Local device. Resetting local device.");
                        LocalDevice.ResetDevice(_restClient.MobileDevice);

                        StateMachine.ClearPersistedState();
                        StateMachine.ResetStateMachine();
                    }
                }

                if (_restClient.Device != null)
                {
                    _restClient.Device.ClientIdUpdated = ClientIdUpdated;
                }
            }
        }
예제 #2
0
 public NotActivated(ActivationStateMachine machine)
     : base(machine)
 {
 }
예제 #3
0
 public WaitingForPushDeviceDetails(ActivationStateMachine machine)
     : base(machine)
 {
 }
예제 #4
0
 public AfterRegistrationSyncFailed(ActivationStateMachine machine)
     : base(machine)
 {
 }
예제 #5
0
 public WaitingForRegistrationSync(ActivationStateMachine machine, Event fromEvent)
     : base(machine)
 {
     FromEvent = fromEvent;
 }
예제 #6
0
 public WaitingForDeregistration(ActivationStateMachine machine, State previousState)
     : base(machine)
 {
     PreviousState = previousState;
 }
예제 #7
0
 protected State(ActivationStateMachine machine)
 {
     Machine = machine;
 }
예제 #8
0
 public WaitingForDeviceRegistration(ActivationStateMachine machine)
     : base(machine)
 {
 }