Ejemplo n.º 1
0
        public NewTabViewModel(ChatClient client)
        {
            this.client = client;

            StartChatCommand = new RelayCommand(_ =>
            {
                StartChat.SafeInvoke(this, new StartChatEventArgs((contactsView.CurrentItem as ContactViewModel).Contact));
            });
            AddFriendCommand = new RelayCommand(_ =>
            {
                if (AddFriendText.Length > 0)
                {
                    client.AddFriend(AddFriendText);
                }
                AddFriendText = "";
            }, _ =>
            {
                return(AddFriendText.Length > 0);
            });

            contactsView            = new ListCollectionView(contactVMs);
            contactsView.CustomSort = new ContactComparer();

            client.UserDetailsChange  += OnUserDetailsChange;
            client.GroupDetailsChange += OnGroupDetailsChange;

            UpdateContacts(client.Friends, Enumerable.Empty <IUser>());
            UpdateContacts(client.Groups, Enumerable.Empty <IGroup>());
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 鼠标双击
 /// </summary>
 /// <param name="e"></param>
 protected override void OnDoubleClick(EventArgs e)
 {
     base.OnDoubleClick(e);
     Invalidate();
     if (SelectedIndex != -1)
     {
         //开启聊天
         StartChat.Invoke(Items[SelectedIndex] as WXUser);
     }
 }
Ejemplo n.º 3
0
 public void StarttheChat()
 {
     StartChat.Click();
     System.Threading.Thread.Sleep(20000);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 发送消息
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSendMsg_Click(object sender, EventArgs e)
 {
     StartChat.Invoke(_friendUser);
 }