private async void ParticipantRemoveExecute(TLChatParticipantBase participant) { if (participant == null || participant.User == null) { return; } var confirm = await TLMessageDialog.ShowAsync(string.Format("Do you want to remove {0} from the group {1}?", participant.User.FullName, _item.DisplayName), "Remove", "OK", "Cancel"); if (confirm == ContentDialogResult.Primary) { var response = await ProtoService.DeleteChatUserAsync(_item.Id, participant.User.ToInputUser()); if (response.IsSucceeded) { if (response.Result is TLUpdates updates) { var newMessage = updates.Updates.OfType <TLUpdateNewMessage>().FirstOrDefault(); if (newMessage != null) { Aggregator.Publish(newMessage); } } } } }
private Visibility ParticipantRemove_Loaded(TLChatParticipantBase participantBase) { switch (participantBase) { case TLChatParticipant participant: return(participant.InviterId == SettingsHelper.UserId ? Visibility.Visible : Visibility.Collapsed); case TLChatParticipantAdmin admin: return(admin.InviterId == SettingsHelper.UserId ? Visibility.Visible : Visibility.Collapsed); } return(Visibility.Collapsed); }