Beispiel #1
0
        private void cl_GroupRemoved(object sender, System.Collaboration.CollectionEventArgs e)
        {
            ContactGroup group = e.Target as ContactGroup;

            foreach (TreeNode node in contactList.Nodes)
            {
                if (node.Tag == group)
                {
                    node.Remove();
                    break;
                }
            }
        }
Beispiel #2
0
        private void cl_GroupAdded(object sender, System.Collaboration.CollectionEventArgs e)
        {
            TreeNode     groupNode;
            TreeNode     addContactNode;
            ContactGroup group = e.Target as ContactGroup;

            groupNode = new TreeNode(group.DisplayName + " (0/0)");
            contactList.Nodes.Insert(contactList.Nodes.Count - 1, groupNode);
            groupNode.Tag = group;

            addContactNode           = groupNode.Nodes.Add("Add contact");
            addContactNode.ForeColor = Color.Gray;
        }
Beispiel #3
0
        private void cl_ContactRemoved(object sender, System.Collaboration.CollectionEventArgs e)
        {
            Contact contact = e.Target as Contact;

            foreach (TreeNode groupNode in contactList.Nodes)
            {
                foreach (TreeNode contactNode in groupNode.Nodes)
                {
                    if (contactNode.Tag == contact)
                    {
                        contactNode.Remove();
                        UpdateGroup(allContactsNode);
                    }
                }
            }
        }
Beispiel #4
0
        private void cl_ContactAdded(object sender, System.Collaboration.CollectionEventArgs e)
        {
            Contact contact = e.Target as Contact;

            TreeNode newContactNode = new TreeNode(contact.DisplayName);

            allContactsNode.Nodes.Insert(allContactsNode.Nodes.Count - 1, newContactNode);
            newContactNode.Tag = contact;

            int numOnline = 0;

            foreach (TreeNode contactNode in allContactsNode.Nodes)
            {
                contact    = contactNode.Tag as Contact;
                numOnline += contactNode.ForeColor == Color.Green ? 1 : 0;
            }
            allContactsNode.Text = allContactsNode.Text.Substring(0, allContactsNode.Text.LastIndexOf(" (")) + " (" + numOnline + "/" + (allContactsNode.Nodes.Count - 1) + ")";
        }
Beispiel #5
0
        private void cl_ContactAddedToGroup(object sender, System.Collaboration.CollectionEventArgs e)
        {
            Contact      contact = e.Target as Contact;
            ContactGroup group   = sender as ContactGroup;

            foreach (TreeNode groupNode in contactList.Nodes)
            {
                if (groupNode.Tag == group)
                {
                    TreeNode newContactNode = new TreeNode(contact.DisplayName);
                    groupNode.Nodes.Insert(groupNode.Nodes.Count - 1, newContactNode);
                    newContactNode.Tag = contact;

                    UpdateGroup(groupNode);

                    break;
                }
            }
        }
Beispiel #6
0
        private void cl_ContactRemovedFromGroup(object sender, System.Collaboration.CollectionEventArgs e)
        {
            Contact      contact = e.Target as Contact;
            ContactGroup group   = sender as ContactGroup;

            foreach (TreeNode groupNode in contactList.Nodes)
            {
                if (groupNode.Tag == group)
                {
                    foreach (TreeNode contactNode in groupNode.Nodes)
                    {
                        if (contactNode.Tag == contact)
                        {
                            contactNode.Remove();
                            UpdateGroup(groupNode);
                            return;
                        }
                    }
                }
            }
        }