private async Task DoCreateChat() { List<InputUser> inputUsers = new List<InputUser>(); ObservableCollection<UserModel> users = SelectableUsers.GetUsers(); foreach (var userModel in users) { if (userModel.IsCheckedInternal) inputUsers.Add(TL.inputUserContact(userModel.Id)); } messages_StatedMessage msg = await TelegramSession.Instance.Api.messages_createChat(inputUsers, ChatTitleEdit.ContentText.Text); TelegramSession.Instance.Updates.Process(msg); foreach (var userModel in SelectableUsers.GetUsers()) { userModel.IsCheckedInternal = false; } }
private async Task <List <SimpleUser> > GetUsers() { var ids = (await mClient.GetContacts()).Cast <ContactConstructor>(); var ius = ids.Select(r => TL.inputUserContact(r.user_id)).ToList(); var users = new List <SimpleUser>(ius.Count); foreach (var user in ius) { var su = new SimpleUser(await mClient.GetFullUser(user)); if (su.Self) { mSelfUserId = su.Id; } users.Add(su); } users.Sort(); return(users); }