protected override async void SendExecute() { var user = SelectedItems.FirstOrDefault(); if (user == null) { return; } TLType type = 0; Task <MTProtoResponse <TLUpdatesBase> > task = null; if (_item is TLChannel channel) { type = TLType.ChannelsInviteToChannel; task = ProtoService.InviteToChannelAsync(channel.ToInputChannel(), new TLVector <TLInputUserBase> { user.ToInputUser() }); } else if (_item is TLChat chat) { var count = 100; var config = CacheService.GetConfig(); if (config != null) { count = config.ForwardedCountMax; } type = TLType.MessagesAddChatUser; task = ProtoService.AddChatUserAsync(chat.Id, user.ToInputUser(), count); } if (task == null) { return; } var response = await task; if (response.IsSucceeded) { NavigationService.GoBack(); if (response.Result is TLUpdates updates) { var newMessage = updates.Updates.FirstOrDefault(x => x is TLUpdateNewMessage) as TLUpdateNewMessage; if (newMessage != null) { Aggregator.Publish(newMessage.Message); } var newChannelMessage = updates.Updates.FirstOrDefault(x => x is TLUpdateNewChannelMessage) as TLUpdateNewChannelMessage; if (newChannelMessage != null) { Aggregator.Publish(newChannelMessage.Message); } } } else { AlertsService.ProcessError(response.Error, type, _item is TLChannel inner && inner.IsBroadcast); } }