Exemplo n.º 1
0
        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);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        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);
        }