Exemplo n.º 1
0
        private void UpdateNode(User u)
        {
            if ( (!u.isOnline) || (u.status == null))
            {
                if (lstBuddies.Items.ContainsKey(u.JID))
                {
                    lstBuddies.Items.RemoveByKey(u.JID);

                    if (jm.theUsers.Where(p => p.Group == u.Group).Count() == 1)
                    {
                        grps.Remove(u.Group);
                    }
                }
            }
            else
            {
                ListViewItem k;
                if (!lstBuddies.Items.ContainsKey(u.JID))
                {
                    k = lstBuddies.Items.Add(u.JID, u.Nickname, u.State);
                    k.SubItems.Add("");
                    k.SubItems.Add("");
                    k.SubItems.Add("");
                    k.UseItemStyleForSubItems = false;

                }
                else
                {
                    k = lstBuddies.Items[u.JID];
                }

                k.SubItems[0].Text = u.Nickname;

                k.SubItems[0].Font = new Font(k.SubItems[0].Font.FontFamily, 9, FontStyle.Bold);
                if (u.State == "outOfGame")
                {
                    k.SubItems[0].ForeColor = Color.Green;
                }
                else
                {
                    k.SubItems[0].ForeColor = Color.OrangeRed;
                }
                if (u.State == "")
                    k.SubItems[1].Text = "";
                else
                {

                    k.SubItems[1].Text = (u.State + " for " + u.duration + " mins");
                }

                k.SubItems[2].Text = ("Normal: " + u.wins + " wins " + u.leaves + " leaves");

                if (u.rankedRating != "0")
                    k.SubItems[3].Text = ("Ranked: " + u.rankedRating + " rating " + u.rankedWins + " wins " + u.rankedLosses + " losses");

                k.ImageKey = u.State;
                if (!grps.ContainsKey(u.Group))
                {
                    grps.Add(u.Group, lstBuddies.Groups.Add(u.Group, u.Group));
                    ((ListViewGroupSorter)lstBuddies).SortGroups(true);
                }
                k.Group = grps[u.Group];
            }
        }
Exemplo n.º 2
0
 private void ShowWindow(User From)
 {
     if (msgWindows.ContainsKey(From))
     {
         msgWindows[From].Show();
         msgWindows[From].Activate();
     }
     else
     {
         frmMessage newWindow = new frmMessage();
         newWindow.Images = imgChamps;
         newWindow.StartPosition = FormStartPosition.Manual;
         newWindow.Location = new Point(SystemInformation.VirtualScreen.Width / 2 - 100 + msgWindows.Count * 30, SystemInformation.VirtualScreen.Height / 2 - 100 + msgWindows.Count * 30);
         newWindow.theUser = From;
         newWindow.Closed += new frmMessage.CloseHandler(newWindow_Closed);
         newWindow.jm = jm;
         msgWindows.Add(From, newWindow);
         newWindow.Show();
     }
 }
Exemplo n.º 3
0
 void jm_UserChanged(User e)
 {
     UpdateNode(e);
 }
Exemplo n.º 4
0
 void newWindow_Closed(User e)
 {
     if (msgWindows.ContainsKey(e))
     {
         msgWindows.Remove(e);
     }
 }
Exemplo n.º 5
0
 void jm_OnMessage(User From, string message, DateTime Date)
 {
     ShowWindow(From);
     msgWindows[From].gotMessage(Date, message);
 }