Exemple #1
0
 private void TextBox1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         bool find = false;
         foreach (DataRow row in friends.Rows)
         {
             if (textBox1.Text.Equals(row[0].ToString()))
             {
                 find = true;
                 if (!Contact.chatKey.ContainsKey(textBox1.Text))
                 {
                     Contact.chatKey.Add(textBox1.Text, new Chatroom(username, textBox1.Text));
                 }
                 if (Contact.chatKey.Count == 1)
                 {
                     Contact.chatKey.Values.First().StartPosition = FormStartPosition.CenterScreen;
                 }
                 CommonHandler.UpdateShowing(textBox1.Text);
                 textBox1.Text = "";
                 break;
             }
         }
         if (!find)
         {
             MessageBox.Show("You don't have this friend!", "Warnning!");
         }
     }
 }
Exemple #2
0
 private void Button1_Click(object sender, EventArgs e)
 {
     Hide();
     if (!Contact.chatKey.ContainsKey(friendname))
     {
         Contact.chatKey.Add(friendname, new Chatroom(username, friendname));
         Contact.chatKey[friendname].Show();
     }
     //if (Contact.chatKey.Count == 1)
     //    Contact.chatKey.Values.First().StartPosition = FormStartPosition.CenterScreen;
     CommonHandler.UpdateShowing(friendname);
 }
Exemple #3
0
 private void ListViewEx1_MouseClick(object sender, MouseEventArgs e)
 {
     string[] strArr = listViewEx1.SelectedItems[0].SubItems[0].Text.Split(':');
     strArr[0] = strArr[0].Remove(strArr[0].Length - 5);
     if (!Contact.chatKey.ContainsKey(strArr[0]))
     {
         Contact.chatKey.Add(strArr[0], new Chatroom(username, strArr[0]));
         Contact.chatKey[strArr[0]].Show();
     }
     //if (Contact.chatKey.Count == 1)
     //    Contact.chatKey.Values.First().StartPosition = FormStartPosition.CenterScreen;
     CommonHandler.UpdateShowing(strArr[0]);
 }
Exemple #4
0
        private void Close_Click(object sender, EventArgs e)
        {
            List <string> list = new List <string>(Contact.chatKey.Keys);

            if (Contact.chatKey.Count() > 1)
            {
                Contact.chatKey[remoteUser].Hide();
                Contact.chatKey.Remove(remoteUser);
                CommonHandler.UpdateShowing(Contact.chatKey.Keys.First());
            }
            else
            {
                Hide();
                Contact.chatKey.Remove(remoteUser);
            }
        }
Exemple #5
0
 private void ListView1_MouseClick(object sender, MouseEventArgs e)
 {
     string[] strArr = listView1.SelectedItems[0].SubItems[0].Text.Split(':');
     CommonHandler.UpdateShowing(strArr[0]);
 }