Esempio n. 1
0
 public UserListRow(PnlUserList parent, GPG.Multiplayer.Client.Clans.ClanMember clanMember, UserListStyles style, UserListCategories initialCategory)
 {
     this.PlayerAwards = null;
     this.PlayerStatus = null;
     this.mCategory = UserListCategories.Online;
     this.mPreviousRow = null;
     this.mNextRow = null;
     this.mIsSelected = false;
     this.LastCategory = null;
     this.ClanRankImage = null;
     this.Award1Image = null;
     this.Award2Image = null;
     this.Award3Image = null;
     this.AvatarImage = null;
     this.StatusImage = null;
     this.ClanLabelBounds = null;
     this.mParent = parent;
     this.mClanMember = clanMember;
     this.mStyle = style;
     this.mCategory = initialCategory;
     this.Parent.MouseMove += new MouseEventHandler(this.Parent_MouseMove);
     this.Parent.MouseDown += new MouseEventHandler(this.Parent_MouseDown);
     this.Parent.MouseUp += new MouseEventHandler(this.Parent_MouseUp);
     this.BindToClanMember(clanMember);
 }
Esempio n. 2
0
 public void PerformCategoryLayout()
 {
     VGen0 method = null;
     int top = 0;
     try
     {
         UserListRow row;
         UserListRow row2;
         if (this.PerformingLayout)
         {
             return;
         }
         this.mPerformingLayout = true;
         int num = 0;
         if (this.Style != UserListStyles.Clan)
         {
             goto Label_0175;
         }
         this.ClearData();
         if (this.ClanMembers != null)
         {
             foreach (ClanMember member in this.ClanMembers)
             {
                 row = new UserListRow(this, member, UserListStyles.Clan, this.DetermineUserCategory(member));
                 row.MouseDown += new MouseEventHandler(this.row_MouseDown);
                 row.MouseUp += new MouseEventHandler(this.row_MouseUp);
                 row.MoveToCategory(this.Categories[row.Category]);
             }
         }
         goto Label_0273;
     Label_0101:
         row = this.RemovedRows.Dequeue();
         this.Categories[row.Category].RemoveRow(row);
         this.UserRows.Remove(row.User);
         Chatroom.GatheringParticipants.RemoveByIndex("name", row.User.Name);
         this.DisposeRow(row);
         if (this.SelectedRow == row)
         {
             this.mSelectedRow = null;
         }
     Label_0175:
         if (this.RemovedRows.Count > 0)
         {
             goto Label_0101;
         }
         while (this.AddedRows.Count > 0)
         {
             row = this.AddedRows.Dequeue();
             this.UserRows[row.User] = row;
             row.MoveToCategory(this.Categories[row.Category]);
         }
         while (this.UpdatedUsers.Count > 0)
         {
             User key = this.UpdatedUsers.Dequeue();
             if (this.UserRows.ContainsKey(key))
             {
                 row = this.UserRows[key];
                 UserListCategories categories = this.DetermineUserCategory(key);
                 Chatroom.GatheringParticipants.ReplaceIntoByIndex("name", key.Name, key);
                 if (categories != row.Category)
                 {
                     row.MoveToCategory(this.Categories[categories]);
                 }
                 row.BindToUser(key);
             }
         }
     Label_0273:
         row2 = null;
         foreach (UserListCategory category in this.Categories.Values)
         {
             if (category.Visible && (category.Count >= 1))
             {
                 category.SetBounds(top);
                 top += category.Height + num;
                 foreach (UserListRow currow in category)
                 {
                     if (category.IsExpanded)
                     {
                         currow.SetBounds(top);
                         currow.PreviousRow = row2;
                         currow.NextRow = null;
                         if (row2 != null)
                         {
                             row2.NextRow = currow;
                         }
                         row2 = currow;
                         top += currow.Height + num;
                     }
                 }
             }
         }
     }
     catch (Exception exception)
     {
         ErrorLog.WriteLine(exception);
     }
     finally
     {
         this.mPerformingLayout = false;
     }
     if ((base.IsHandleCreated && !base.Disposing) && !base.IsDisposed)
     {
         if (method == null)
         {
             method = delegate {
                 this.gpgPanelBody.Height = top;
                 this.gpgPanelBody.Invalidate();
                 this.gpgPanelBody.Update();
             };
         }
         base.Invoke(method);
     }
 }
Esempio n. 3
0
 public void AddUser(User user, bool block, bool refresh)
 {
     WaitCallback callBack = null;
     if (((!block && !base.InvokeRequired) && !base.Disposing) && !base.IsDisposed)
     {
         if (callBack == null)
         {
             callBack = delegate (object s) {
                 this.AddUser(user);
             };
         }
         ThreadPool.QueueUserWorkItem(callBack);
     }
     else if ((!base.Disposing && !base.IsDisposed) && this.IsBound)
     {
         if (this.UserRows.ContainsKey(user))
         {
             this.UpdateUser(user);
         }
         else
         {
             UserListRow item = null;
             UserListCategories initialCategory = this.DetermineUserCategory(user);
             if (this.Style == UserListStyles.Chatroom)
             {
                 int index = Chatroom.GatheringParticipants.IndexOf(user);
                 if (index >= 0)
                 {
                     Chatroom.GatheringParticipants.IndexObject(user);
                     Chatroom.GatheringParticipants[index] = user;
                 }
                 else
                 {
                     Chatroom.GatheringParticipants.IndexObject(user);
                     Chatroom.GatheringParticipants.Add(user);
                 }
             }
             item = new UserListRow(this, user, this.Style, initialCategory);
             item.MouseDown += new MouseEventHandler(this.row_MouseDown);
             item.MouseUp += new MouseEventHandler(this.row_MouseUp);
             this.AddedRows.Enqueue(item);
             if (refresh && this.AutoRefresh)
             {
                 this.RefreshData();
             }
         }
     }
 }
Esempio n. 4
0
 private void DisposeRow(UserListRow row)
 {
     row.MouseDown -= new MouseEventHandler(this.row_MouseDown);
     row.MouseUp -= new MouseEventHandler(this.row_MouseUp);
     row.Dispose();
 }
Esempio n. 5
0
 public void ClearData()
 {
     this.mSelectedRow = null;
     this.RemovedRows.Clear();
     this.AddedRows.Clear();
     this.UpdatedUsers.Clear();
     this.mUserRows.Clear();
     foreach (UserListCategory category in this.Categories.Values)
     {
         foreach (UserListRow row in category.Rows.Values)
         {
             this.DisposeRow(row);
         }
         category.Clear();
     }
 }
Esempio n. 6
0
 private void row_MouseDown(object sender, MouseEventArgs e)
 {
     UserListRow row = sender as UserListRow;
     this.LastClick2 = this.LastClick1;
     this.LastClick1 = row;
     if (this.SelectedRow != row)
     {
         if (this.SelectedRow != null)
         {
             this.SelectedRow.IsSelected = false;
         }
         this.mSelectedRow = row;
         this.gpgPanelBody.Invalidate();
         this.gpgPanelBody.Update();
     }
 }
Esempio n. 7
0
        private void PnlUserList_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.Up:
                    if ((this.SelectedRow != null) && (this.SelectedRow.PreviousRow != null))
                    {
                        this.SelectedRow.IsSelected = false;
                        this.mSelectedRow = this.SelectedRow.PreviousRow;
                        this.SelectedRow.IsSelected = true;
                        if (!this.VisibleBounds.Contains(1, this.SelectedRow.Top))
                        {
                            if ((base.VerticalScroll.Value - (base.VerticalScroll.SmallChange * 4)) < 0)
                            {
                                base.VerticalScroll.Value = 0;
                            }
                            else
                            {
                                VScrollProperties verticalScroll = base.VerticalScroll;
                                verticalScroll.Value -= base.VerticalScroll.SmallChange * 4;
                            }
                        }
                        this.gpgPanelBody.Invalidate();
                        this.gpgPanelBody.Update();
                        break;
                    }
                    break;

                case Keys.Down:
                    if ((this.SelectedRow != null) && (this.SelectedRow.NextRow != null))
                    {
                        this.SelectedRow.IsSelected = false;
                        this.mSelectedRow = this.SelectedRow.NextRow;
                        this.SelectedRow.IsSelected = true;
                        if (!this.VisibleBounds.Contains(1, this.SelectedRow.Top + this.SelectedRow.Height))
                        {
                            if ((base.VerticalScroll.Value + (base.VerticalScroll.SmallChange * 4)) > base.VerticalScroll.Maximum)
                            {
                                base.VerticalScroll.Value = base.VerticalScroll.Maximum;
                            }
                            else
                            {
                                VScrollProperties properties2 = base.VerticalScroll;
                                properties2.Value += base.VerticalScroll.SmallChange * 4;
                            }
                        }
                        this.gpgPanelBody.Invalidate();
                        this.gpgPanelBody.Update();
                        break;
                    }
                    break;

                case Keys.Return:
                    if (this.SelectedUser != null)
                    {
                        base.MainForm.OnSendWhisper(this.SelectedUser.Name, null);
                    }
                    break;
            }
        }