Example #1
0
        public string GetSelectedUserList() {
            ObservableCollection<UserModel> users = SelectableUsers.GetUsers();
            string text = "";

            foreach (var userModel in users) {
                if (userModel.IsCheckedInternal)
                    text += " " + userModel.FullName + ";";
            }

            return text;
        }
Example #2
0
        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;
            }
        }
Example #3
0
        public NewGroup() {
            InitializeComponent();

            ChatTitleEdit.TitleText.Text = "Subject:";
            ChatTitleEdit.ContentText.Text = "New chat";
            ChatMembersEdit.TitleText.Text = "Members:";
            ChatMembersEdit.ContentText.Text = "";

            ChatMembersEdit.ContentText.TextChanged += ContentTextOnTextChanged;
            ChatMembersEdit.ContentText.GotFocus += ContentTextOnGotFocus;
            SelectableUsers.UserSelectedFromList += SelectableUsersOnUserSelectedFromList;

            BackKeyPress += delegate {
                foreach (var userModel in SelectableUsers.GetUsers()) {
                    userModel.IsCheckedInternal = false;
                }
            };
        }
Example #4
0
        private void FinishClick(object sender, EventArgs e) {
            if (ChatTitleEdit.ContentText.Text == "") {
                ChatTitleEdit.ContentText.Focus();
                return;
            }

            ObservableCollection<UserModel> users = SelectableUsers.GetUsers();

            bool haveUsers = false;
            foreach (var userModel in users) {
                if (userModel.IsCheckedInternal) { 
                    haveUsers = true;
                    break;
                }
            }

            if (!haveUsers) {
                ChatMembersEdit.ContentText.Focus();
                return;
            }

            DoCreateChat();
            NavigationService.Navigate(new Uri("/UI/Pages/StartPage.xaml", UriKind.Relative));
        }