예제 #1
0
        /// <exception cref="ConnectionException">Could not send feedback because the device is not connected to the web.</exception>
        public async Task SendFeedbackAsync(int sessionId, ScoredFeedback feedback)
        {
            if (!CrossConnectivity.Current.IsConnected)
            {
                throw new ConnectionException();
            }

            try
            {
                await _apiService.SendFeedbackAsync(sessionId, feedback).ConfigureAwait(false);

                _dispatcherHelper.ExecuteOnUiThread(
                    () =>
                    _dialogService.ShowMessageBox(_loc.GetLocalizedString(Localized.FeedbackSent),
                                                  _loc.GetLocalizedString(Localized.Success)));
            }
            catch (Exception e)
            {
                await CatchExceptionAsync(e);
            }
            finally
            {
                Messenger.Default.Send(new SubmittingMessage(false));
            }
        }
        public SessionViewModel(IDialogService dialogService, ILocalizedStringProvider loc,
                                ILoggingService loggingService, IAuthenticationService authService, IContactService contactService,
                                IDispatcherHelper dispatcher, INavigationService navigationService)
            : base(dialogService, loc, loggingService, authService, dispatcher, navigationService)
        {
            _contactService  = contactService;
            _contactForm     = new ContactForm();
            _scoredFeedback  = new ScoredFeedback();
            _subscription    = new Subscription();
            ParticipantToAdd = new Participant();

            if (IsInDesignMode)
            {
                Session  = FakeCourseService.GenerateFakeSession(123);
                Identity = new Identity();
                Subscription.Participants.Add(new Participant
                {
                    FirstName = "First",
                    LastName  = "Last",
                    Email     = "*****@*****.**"
                });
            }

            Messenger.Default.Register <AuthenticationChangedMessage>(this,
                                                                      m => DispatcherHelper.ExecuteOnUiThread(() => Identity = m.NewIdentity));
        }
 public Task SendFeedbackAsync(int sessionId, ScoredFeedback feedback) => ToDebugAsync(sessionId, feedback);