Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="friend"></param>
        /// <param name="newName"></param>
        public void OnFriendChangeDisplayName(Friend friend, string newName)
        {
            FriendTreeNode node = (FriendTreeNode)this.friendsTable[friend];

            node.Text = newName;
            SetFriendToolTip(node, newName, friend.Status, friend.EmailAddress);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="friend"></param>
        /// <param name="newStatus"></param>
        public void OnFriendChangeStatus(Friend friend, OnlineStatus newStatus)
        {
            FriendTreeNode node = (FriendTreeNode)this.friendsTable[friend];

            if (node != null)
            {
                // friend went offline, transfer him to the offline list
                if (friend.Status != OnlineStatus.Offline && newStatus == OnlineStatus.Offline)
                {
                    // move treenode to offline tree
                    this.TreeView.Invoke(new FriendTreeHandler(RemoveFriendFromTree), new object[] { this, node });
                    this.TreeView.Invoke(new FriendTreeHandler(AddFriendToTree), new object[] { this.offlineTreeNode, node });
                }
                // else friend has just came online from being offline
                else if (friend.Status == OnlineStatus.Offline && newStatus != OnlineStatus.Offline)
                {
                    // move treenode from offline tree to protocol tree
                    this.TreeView.Invoke(new FriendTreeHandler(RemoveFriendFromTree), new object[] { this.offlineTreeNode, node });
                    this.TreeView.Invoke(new FriendTreeHandler(AddFriendToTree), new object[] { this, node });
                }

                node.CollapsedImageIndex = node.ExpandedImageIndex = GetFriendNodeImageIndex(newStatus);
                SetFriendToolTip(node, friend.DisplayName, newStatus, friend.EmailAddress);
            }
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="friend"></param>
        public void OnFriendRemove(Friend friend)
        {
            FriendTreeNode node = (FriendTreeNode)this.friendsTable[friend];

            node.Remove();
            this.friendsTable.Remove(friend);
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnContactTreeDoubleClick(object sender, EventArgs e)
        {
            // determine what node we clicked on
            TreeNodeEx node = this.contactTreeView.GetNodeAt(
                this.contactTreeView.PointToClient(WinForms.Control.MousePosition)
                );

            if (node != null && node is FriendTreeNode)
            {
                // create a conversation box if we clicked on a friend's name.
                FriendTreeNode fnode = (FriendTreeNode)node;
                fnode.Protocol.StartConversation(fnode.Friend, false, null, new OperationCompleteEvent());
            }
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="forced"></param>
        public void OnDisconnect(bool forced)
        {
            this.FontStyle = Drawing.FontStyle.Regular;
            this.friendsTable.Clear();

            this.Nodes.Clear();

            for (int i = 0; i < this.offlineTreeNode.Nodes.Count; ++i)
            {
                FriendTreeNode node = (FriendTreeNode)this.offlineTreeNode.Nodes[i];

                if (node.Protocol.Name == this.protocol.Name)
                {
                    node.Remove();
                    --i;
                }
            }
        }
Example #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="friend"></param>
        public void OnFriendAdd(Friend friend)
        {
            FriendTreeNode node = new FriendTreeNode(this.protocol, friend);

            node.ContextMenu         = new FriendMenu(this.protocol, friend);
            node.CollapsedImageIndex = node.ExpandedImageIndex = this.GetFriendNodeImageIndex(friend.Status);

            SetFriendToolTip(node, friend.DisplayName, friend.Status, friend.EmailAddress);

            if (friend.Status == OnlineStatus.Offline)
            {
                offlineTreeNode.Nodes.Add(node);
            }
            else
            {
                this.Nodes.Add(node);
            }

            this.friendsTable.Add(friend, node);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="friend"></param>
        public void OnFriendAdd(Friend friend)
        {
            FriendTreeNode node = new FriendTreeNode(this.protocol, friend);

            node.ContextMenu = new FriendMenu(this.protocol, friend);
            node.CollapsedImageIndex = node.ExpandedImageIndex = this.GetFriendNodeImageIndex(friend.Status);

            SetFriendToolTip(node, friend.DisplayName, friend.Status, friend.EmailAddress);

            if (friend.Status == OnlineStatus.Offline)
                offlineTreeNode.Nodes.Add(node);
            else
                this.Nodes.Add(node);

            this.friendsTable.Add(friend, node);
        }