示例#1
0
        //////////////////////////////////////////////////////////////////////////

        // Bring the edit contact dialog and set information accordingly
        private void editContactToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (contactsTreeView.SelectedNode.Level == 1)
            {
                Contact     contact = (Contact)contactsTreeView.SelectedNode;
                Group       group   = (Group)contactsTreeView.SelectedNode.Parent;
                EditContact dialog  = new EditContact();
                dialog.nameTextBox.Text           = contact.Name;
                dialog.jabberIDLabel.Text         = contact.JabberID;
                dialog.groupComboBox.DataSource   = contactsTreeView.Nodes;
                dialog.groupComboBox.SelectedItem = group;
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    if (dialog.groupComboBox.SelectedItem != null && !dialog.groupComboBox.SelectedItem.ToString().Equals("Default Group"))
                    {
                        model.sendRosterSet(contact.JabberID, dialog.nameTextBox.Text, dialog.groupComboBox.SelectedItem.ToString());
                    }
                    else
                    {
                        model.sendRosterSet(contact.JabberID, dialog.nameTextBox.Text, (String)null);
                    }
                }
            }
        }
		//////////////////////////////////////////////////////////////////////////		

		// Bring the edit contact dialog and set information accordingly
		private void editContactToolStripMenuItem_Click(object sender, EventArgs e) {
			if(contactsTreeView.SelectedNode.Level == 1) {
				Contact contact = (Contact)contactsTreeView.SelectedNode;
				Group group = (Group)contactsTreeView.SelectedNode.Parent;
				EditContact dialog = new EditContact();
				dialog.nameTextBox.Text = contact.Name;
				dialog.jabberIDLabel.Text = contact.JabberID;
				dialog.groupComboBox.DataSource = contactsTreeView.Nodes;
				dialog.groupComboBox.SelectedItem = group;
				if(dialog.ShowDialog() == DialogResult.OK) {
					if(dialog.groupComboBox.SelectedItem != null && !dialog.groupComboBox.SelectedItem.ToString().Equals("Default Group"))
						model.sendRosterSet(contact.JabberID, dialog.nameTextBox.Text, dialog.groupComboBox.SelectedItem.ToString());
					else
						model.sendRosterSet(contact.JabberID, dialog.nameTextBox.Text, (String)null);
				}
			}
		}