Exemple #1
0
        public bool TriggerEnrollment(TriggerEnrollmentRequest request)
        {
            if (!_mirrorStateServices.GetCurrentUser().IsDefaultUser)
            {
                return(false);
            }

            _voiceUseCasesStateService.SetCurrentDetectionState(VoiceUseCasesState.EnrollmentDetection);
            _voiceUseCasesStateService.SetUserForEnrollment(request.SnowUser);
            _mirrorStateServices.SetCurrentUserTo(new MirrorUser(request.SnowUser, false, false, null));
            _deliveryBoundary.DeliverEnrollmentPage();
            return(true);
        }
        public async void TriggerDefaultUser()
        {
            var weather = await _weatherService.GetWeather("Karlsruhe");

            var newsSources = await _newsService.GetSources("en");

            var news = await _newsService.GetNews(newsSources);

            var displayName = (_appSettingsService.GetLocalMirrorNames()).DisplayName;
            var secretName  = (_appSettingsService.GetLocalMirrorNames()).SecretName;

            //List<MirrorAction> actions = new List<MirrorAction>();

            //Task postfachTask = Task.Run(async () =>
            //{
            //    actions = await _handshakeService.CheckPostfach(secretName);

            //});

            //// background task in uwp isn't that easy...no time
            //await Task.Run(() => {
            //    actions = _handshakeService.CheckPostfach(secretName).Result;
            //    Task.Delay(6000);
            //});

            await _deliveryBoundary.DeliverDefaultUserPage().ConfigureAwait(false);

            _defaultUserPresenter.OnPresent(new DefaultUserResponse(weather, news, displayName));
            _mirrorStateServices.SetCurrentUserTo(_mirrorStateServices.LoadDefaultUser());

            //foreach(var action in actions)
            //{
            //    if (action.TargetAction == Entities.Action.Handshake)
            //    {
            //        _mirrorStateServices.SetCurrentUserTo(
            //            new MirrorUser(new SnowUser(action.User.FirstName, action.User.LastName, action.User.Email, action.User.SnowId),
            //            false,
            //            true,
            //            null
            //        ));
            //    }
            //    else
            //    {
            //        _mirrorStateServices.SetCurrentUserTo(_mirrorStateServices.LoadDefaultUser());
            //    }
            //}
        }