public ChildInviteToTeamItemViewModel(IInviteService inviteService) { _inviteService = inviteService; AcceptCommand = new Command(async() => { try { TeamInviteConfirmResponse teamInviteConfirmResponse = await _inviteService.TeamInviteConfirmAsync(((TeamDTO)InviteTo).Id, default(CancellationToken), Child.Id); if (teamInviteConfirmResponse != null) { MessagingCenter.Send <object, long>(this, GlobalSettings.Instance.AppMessagingEvents.TeamEvents.InviteAccepted, ((TeamDTO)InviteTo).Id); await DialogService.ToastAsync("Child joined to team"); } } catch (OperationCanceledException) { } catch (ObjectDisposedException) { } catch (ServiceAuthenticationException) { } catch (Exception exc) { Crashes.TrackError(exc); await DialogService.ToastAsync(exc.Message); } }); DeclineCommand = new Command(async() => { try { TeamInviteRejectResponse teamInviteRejectResponse = await _inviteService.TeamInviteRejectAsync(((TeamDTO)InviteTo).Id, default(CancellationToken), Child.Id); if (teamInviteRejectResponse != null) { MessagingCenter.Send <object, long>(this, GlobalSettings.Instance.AppMessagingEvents.TeamEvents.InviteDeclined, ((TeamDTO)InviteTo).Id); await DialogService.ToastAsync("Child reject invite to team"); } } catch (OperationCanceledException) { } catch (ObjectDisposedException) { } catch (ServiceAuthenticationException) { } catch (Exception exc) { Crashes.TrackError(exc); await DialogService.ToastAsync(exc.Message); } }); }
private async Task OnAccept(CancellationToken cancellationToken) { try { TeamInviteConfirmResponse teamInviteConfirmResponse = await _inviteService.TeamInviteConfirmAsync(TeamId, cancellationToken); if (teamInviteConfirmResponse != null) { MessagingCenter.Send <object, long>(this, GlobalSettings.Instance.AppMessagingEvents.TeamEvents.InviteAccepted, TeamId); await DialogService.ToastAsync($"You are joined into {TeamName}!"); } } catch (OperationCanceledException) { } catch (ObjectDisposedException) { } catch (ServiceAuthenticationException) { } catch (Exception exc) { Crashes.TrackError(exc); await DialogService.ToastAsync(exc.Message); } }