Beispiel #1
0
        public UserContact(UserContact selectedItem)
        {
            Id = selectedItem.Id;
            Nickname = selectedItem.Nickname;
            FirstName = selectedItem.FirstName;
            LastName = selectedItem.LastName;
            Online = selectedItem.Online;

        }
Beispiel #2
0
        private void DeleteContact_Click(object sender, RoutedEventArgs e)
        {
            if (ContactListView.SelectedItem == null)
                return;
            UserContact contact = new UserContact((UserContact)ContactListView.SelectedItem);
            string login = contact.Nickname;
            Guid contactId = contact.GetId();
            foreach (var cont in Contacts)
            {
                if (cont.Nickname == login)
                {
                    MessageBoxResult dialogResult = MessageBox.Show("Вы хотите удалить контакт " + login, "Удаление контакта", MessageBoxButton.OKCancel, MessageBoxImage.Question);
                    if (dialogResult == MessageBoxResult.Cancel)
                        return;
                    if (dialogResult == MessageBoxResult.OK)
                    {
                        var result = ServerClient.DeleteContact(CurrentUserId, contactId);
                        if (!result)
                        {
                            MessageBox.Show("Невозможно добавить пользователя", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                        else
                        {
                            MessageBox.Show("Контакт успешно добавлен", "Успешно", MessageBoxButton.OK, MessageBoxImage.Information);
                        }

                    }
                    ContactListView.SelectedItem = null;
                    RefreshContacts();
                    break;
                }
            }
        } 
Beispiel #3
0
 private void ContactListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (ContactListView.SelectedItem == null)
         return;
     UserContact contact = new UserContact((UserContact)ContactListView.SelectedItem);
     string login = contact.Nickname;
     foreach (var cont in Contacts)
     {
         if (cont.Nickname == login)
         {
             var chat = new Chat(CurrentUserId, cont.Id, cont.Nickname, this);
             ChatStartedGuids.Add(cont.Id);
             chat.Uid = cont.Id.ToString();
             ChatWindows.Add(chat);
             chat.Show();
             ContactListView.SelectedItem = null;
             break;
         }
     }
 }