protected async override void OnAddMemberToTheClique() { Guid busyKey = Guid.NewGuid(); UpdateBusyVisualState(busyKey, true); ResetCancellationTokenSource(ref _attachMembersToTheGroupCancellationTokenSource); CancellationTokenSource cancellationTokenSource = _attachMembersToTheGroupCancellationTokenSource; try { List <MemberDTO> attachedMembers = await _groupsService.InviteMemberToTheGroupAsync(new InviteMembersToTheGroupDataModel() { ProfileId = GlobalSettings.Instance.UserProfile.Id, GroupId = _targetGroup.Id, MembersIds = PossibleGroupMembers.Select <ProfileDTO, long>(pDTO => pDTO.Id).ToArray <long>() }, cancellationTokenSource); if (attachedMembers != null && attachedMembers.Any()) { await DialogService.ToastAsync(_GROUP_INVITE_HAS_BEEN_SENT_MESSAGE); /// /// TODO: use appropriate messaging event (remove old approach) /// await((ContentPageBaseViewModel)NavigationService.LastPageViewModel).InitializeAsync(new MembersAttachedToTheGroupArgs() { AttachedMembers = attachedMembers }); ClosePopupCommand.Execute(null); } } catch (OperationCanceledException) { } catch (ObjectDisposedException) { } catch (ServiceAuthenticationException) { } catch (Exception exc) { Crashes.TrackError(exc); await DialogService.ToastAsync(exc.Message); } UpdateBusyVisualState(busyKey, false); }
protected async override void OnAddMemberToTheClique() { Guid busyKey = Guid.NewGuid(); UpdateBusyVisualState(busyKey, true); ResetCancellationTokenSource(ref _inviteMemberToTheTeamCancellationTokenSource); CancellationTokenSource cancellationTokenSource = _inviteMemberToTheTeamCancellationTokenSource; try { Tuple <List <ProfileDTO>, string> inviteResult = await _inviteService.AddMembersToTheTeamByTeamIdAsync(_targetTeam.Id, PossibleGroupMembers.Select <ProfileDTO, long>((pDTO) => pDTO.Id), cancellationTokenSource); if (string.IsNullOrEmpty(inviteResult.Item2) || string.IsNullOrWhiteSpace(inviteResult.Item2)) { await DialogService.ToastAsync(AddMemberToTeamPopupViewModel._TEAM_INVITE_HAS_BEEN_SENT_MESSAGE); await((ContentPageBaseViewModel)NavigationService.LastPageViewModel).InitializeAsync(new MembersAttachedToTheTeamArgs() { AttachedMembers = inviteResult.Item1 }); ClosePopupCommand.Execute(null); } else { await DialogService.ToastAsync(inviteResult.Item2); if (inviteResult.Item1.Any()) { PossibleGroupMembers = PossibleGroupMembers .Except <ProfileDTO>(PossibleGroupMembers.Where <ProfileDTO>((pDTO) => inviteResult.Item1.Any(invitedPDTO => invitedPDTO.Id == pDTO.Id))) .ToObservableCollection(); await((ContentPageBaseViewModel)NavigationService.LastPageViewModel).InitializeAsync(new MembersAttachedToTheTeamArgs() { AttachedMembers = inviteResult.Item1 }); } } } catch (OperationCanceledException) { } catch (ObjectDisposedException) { } catch (ServiceAuthenticationException) { } catch (Exception exc) { Crashes.TrackError(exc); await DialogService.ToastAsync(exc.Message); } UpdateBusyVisualState(busyKey, false); }