Ejemplo n.º 1
0
        //opens PersonToPerson chat
        private async void ContactList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            string           id;
            ContactItemModel model = ((sender as ListView).SelectedItems[0]) as ContactItemModel;

            try
            {
                id = local_Groups.Where(w => w.GroupType == Local_Group.GroupTypes.PersonToPerson && ((w.Users[0].ContactNickname == model.ContactNickname && w.Users[1].ContactNickname == username) || (w.Users[1].ContactNickname == model.ContactNickname && w.Users[0].ContactNickname == username))).SingleOrDefault().GroupId;
            }
            catch
            {
                var parsed = await HTTP_SocketForUser.Create_Group(new List <User>() { user, new User()
                                                                                       {
                                                                                           Id = model.ApplicationUserId, ContactNickname = model.ContactNickname
                                                                                       } }, model.ContactNickname + username, Local_Group.GroupTypes.PersonToPerson);

                id = parsed["Id"].ToString();
            }
            await Dispatcher.BeginInvoke(new Action(() =>
            {
                Chats.Items.Add(new TabItem()
                {
                    Content = new Frame()
                    {
                        Content = new ChatPage(username, id, url)
                    }, Header = model.ContactNickname
                });
            }));
        }
Ejemplo n.º 2
0
 private void CreateGroup_Click(object sender, RoutedEventArgs e)
 {
     HTTP_SocketForUser.Create_Group(group_users, tbGroupName.Text, Local_Group.GroupTypes.BigGroup);
     this.Close();
 }