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 OnDecline(CancellationToken cancellationToken) { try { TeamInviteRejectResponse teamInviteRejectResponse = await _inviteService.TeamInviteRejectAsync(TeamId, cancellationToken); if (teamInviteRejectResponse != null) { MessagingCenter.Send <object, long>(this, GlobalSettings.Instance.AppMessagingEvents.TeamEvents.InviteDeclined, TeamId); await DialogService.ToastAsync($"You are reject invite to {TeamName}!"); } } catch (OperationCanceledException) { } catch (ObjectDisposedException) { } catch (ServiceAuthenticationException) { } catch (Exception exc) { Crashes.TrackError(exc); await DialogService.ToastAsync(exc.Message); } }