Пример #1
0
        internal void UpdateBuddy(IRCConnection connection, BuddyListItem buddy)
        {
            if (this.InvokeRequired)
            {
                UpdateBuddyListDelegate ubl = new UpdateBuddyListDelegate(UpdateBuddy);
                this.Invoke(ubl, new object[] { connection, buddy });
            }
            else
            {
                try
                {
                    //check if buddy is already in list
                    RemoveBuddy(connection, buddy);

                    TreeNode t = new TreeNode
                    {
                        Text = buddy.Nick,
                        Tag  = connection
                    };

                    if (buddy.Connected)
                    {
                        t.ToolTipText = buddy.Nick + " on " + connection.ServerSetting.RealServerName;
                        this.treeBuddies.Nodes[1].Nodes.Add(t);
                        if (buddy.PreviousState == false)
                        {
                            _parent.PlaySoundFile("buddy");

                            if (_parent.IceChatOptions.SystemTrayBuddyOnline == true && _parent.IceChatOptions.SystemTrayServerMessage)
                            {
                                _parent.ShowTrayNotification("Your buddy " + buddy.Nick + " has come online on " + connection.ServerSetting.RealServerName);
                            }
                        }
                        buddy.PreviousState = true;
                    }
                    else if (!buddy.Nick.StartsWith(";"))
                    {
                        t.ToolTipText = buddy.Nick + " not on " + connection.ServerSetting.RealServerName;
                        this.treeBuddies.Nodes[0].Nodes.Add(t);
                        buddy.PreviousState = false;
                    }


                    this.treeBuddies.ExpandAll();
                }
                catch (Exception)
                {
                    //
                }
            }
        }
Пример #2
0
        internal void UpdateBuddy(IRCConnection connection,  BuddyListItem buddy)
        {
            if (this.InvokeRequired)
            {
                UpdateBuddyListDelegate ubl = new UpdateBuddyListDelegate(UpdateBuddy);
                this.Invoke(ubl, new object[] { connection, buddy });
            }
            else
            {
                TreeNode t = new TreeNode();
                t.Text = buddy.Nick;
                t.Tag = connection;
                t.ToolTipText = connection.ServerSetting.ServerName;

                if (buddy.Connected)
                {
                    this.treeBuddies.Nodes[1].Nodes.Add(t);
                    if (buddy.PreviousState == false)
                        FormMain.Instance.PlaySoundFile("buddy");
                    buddy.PreviousState = true;
                }
                else if (!buddy.Nick.StartsWith(";"))
                {
                    this.treeBuddies.Nodes[0].Nodes.Add(t);
                    buddy.PreviousState = false;
                }
                this.treeBuddies.ExpandAll();
            }
        }
Пример #3
0
        internal void UpdateBuddy(IRCConnection connection, BuddyListItem buddy)
        {
            if (this.InvokeRequired)
            {
                UpdateBuddyListDelegate ubl = new UpdateBuddyListDelegate(UpdateBuddy);
                this.Invoke(ubl, new object[] { connection, buddy });
            }
            else
            {
                //check if buddy is already in list
                RemoveBuddy(connection, buddy);

                TreeNode t = new TreeNode();
                t.Text = buddy.Nick;
                t.Tag = connection;

                if (buddy.Connected)
                {
                    t.ToolTipText = buddy.Nick + " on " + connection.ServerSetting.RealServerName;
                    this.treeBuddies.Nodes[1].Nodes.Add(t);
                    if (buddy.PreviousState == false)
                    {
                        _parent.PlaySoundFile("buddy");

                        if (_parent.IceChatOptions.SystemTrayBuddyOnline == true && _parent.IceChatOptions.SystemTrayServerMessage)
                            _parent.ShowTrayNotification("Your buddy " + buddy.Nick + " has come online on " + connection.ServerSetting.RealServerName);

                    }
                    buddy.PreviousState = true;
                }
                else if (!buddy.Nick.StartsWith(";"))
                {
                    t.ToolTipText = buddy.Nick + " not on " + connection.ServerSetting.RealServerName;
                    this.treeBuddies.Nodes[0].Nodes.Add(t);
                    buddy.PreviousState = false;
                }

                this.treeBuddies.ExpandAll();
            }
        }