public void PopulatePanels()
        {
            PauseUpdates();
            int position = 4;
            List<long> ids = new List<long>();

            Dictionary<string, IUpdatePanel>.Enumerator e = panels.GetEnumerator();
            while (e.MoveNext())
            {
                e.Current.Value.Dispose();
            }
            mainPanel.Controls.Clear();
            panels.Clear();

            if (UserAccount.CurrentGroup != null)
            {
                foreach (EVEAccount account in UserAccount.CurrentGroup.Accounts)
                {
                    foreach (APICharacter character in account.Chars)
                    {
                        if (!charsListeningTo.Contains(character))
                        {
                            character.UpdateEvent += new APIUpdateEvent(character_UpdateEvent);
                            charsListeningTo.Add(character);
                        }
                        //if (character.CharIncWithRptGroup)
                        if (character.CharIncWithRptGroup && character.AccessType == CharOrCorp.Char)
                        {
                            if (!ids.Contains(character.CharID))
                            //if(1==1)
                            {
                                IUpdatePanel panel;
                                if (UserAccount.Settings.UseCompactUpdatePanel)
                                {
                                    panel = new UpdatePanelCompact(CharOrCorp.Char, character);
                                }
                                else
                                {
                                    panel = new UpdatePanel(CharOrCorp.Char, character);
                                }
                                panel.Size = new Size(mainPanel.ClientSize.Width - 6 /*-
                                    (position >= this.Height -
                                        System.Windows.Forms.SystemInformation.CaptionHeight ?
                                        System.Windows.Forms.SystemInformation.VerticalScrollBarWidth : 0)*/,
                                    panel.Size.Height);
                                panel.Location = new Point(4, position);
                                panel.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
                                panel.UpdateEvent += new APIUpdateEvent(panel_UpdateEvent);
                                mainPanel.Controls.Add(panel as UserControl);
                                position += panel.Height + 8;
                                panels.Add("C" + character.CharID, panel);
                                ids.Add(character.CharID);
                            }
                        }
                        //if (character.CorpIncWithRptGroup)
                        if (character.CorpIncWithRptGroup && character.AccessType == CharOrCorp.Corp)
                        {
                            if (!ids.Contains(character.CorpID))
                            //if(1==1)
                            {
                                IUpdatePanel panel;
                                if (UserAccount.Settings.UseCompactUpdatePanel)
                                {
                                    panel = new UpdatePanelCompact(CharOrCorp.Corp, character);
                                }
                                else
                                {
                                    panel = new UpdatePanel(CharOrCorp.Corp, character);
                                }
                                panel.Size = new Size(mainPanel.ClientSize.Width - 6 /*-
                                    (position > this.Height -
                                        System.Windows.Forms.SystemInformation.CaptionHeight ?
                                        System.Windows.Forms.SystemInformation.VerticalScrollBarWidth : 0)*/,
                                    panel.Size.Height);
                                panel.Location = new Point(4, position);
                                panel.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
                                panel.UpdateEvent += new APIUpdateEvent(panel_UpdateEvent);
                                mainPanel.Controls.Add(panel as UserControl);
                                position += panel.Height + 8;
                                panels.Add("O" + character.CharID, panel);
                                ids.Add(character.CorpID);
                            }
                        }
                    }
                }
            }
            ResumeUpdates();
        }
 private void UpdateStatus_Load(object sender, EventArgs e)
 {
     IUpdatePanel tmpPanel;
     if (UserAccount.Settings.UseCompactUpdatePanel)
     {
         tmpPanel = new UpdatePanelCompact();
     }
     else
     {
         tmpPanel = new UpdatePanel();
     }
     _borderWidth = this.Width - this.ClientSize.Width;
     if (this.Width < tmpPanel.Width + _borderWidth)
     {
         this.Width = tmpPanel.Width + _borderWidth;
     }
     //mainPanel.Width = tmpPanel.Width + 6;
     PopulatePanels();
     updateTimer.Start();
 }