/// <summary> /// Updates the characters' list with the provided monitors /// </summary> public void UpdateContent() { this.SuspendLayout(); try { CleanUp(); // Updates the visibility of the label for when no characters are loaded bool noCharacters = EveClient.MonitoredCharacters.IsEmpty(); labelNoCharacters.Visible = noCharacters; if (noCharacters) { return; } // Creates the controls var characters = new List <Character>(); if (Settings.UI.MainWindow.PutTrainingSkillsFirstOnOverview) { characters.AddRange(EveClient.MonitoredCharacters.Where(x => x.IsTraining)); characters.AddRange(EveClient.MonitoredCharacters.Where(x => !x.IsTraining)); } else { characters.AddRange(EveClient.MonitoredCharacters); } foreach (var character in characters) { // Creates a control and adds it var item = new OverviewItem(character, Settings.UI.MainWindow); item.Click += new EventHandler(item_Click); item.Clickable = true; // Ensure that the control gets created before we add it, // (when Overview is created and then we hide a character, // the control gets created after the custom layout has been performed, // causing the controls to get misplaced) item.CreateControl(); // Add it this.Controls.Add(item); } PerformCustomLayout(); } finally { this.ResumeLayout(); } }
/// <summary> /// Updates the characters' list with the provided monitors /// </summary> public void UpdateContent() { this.SuspendLayout(); try { CleanUp(); // Updates the visibility of the label for when no characters are loaded bool noCharacters = EveClient.MonitoredCharacters.IsEmpty(); labelNoCharacters.Visible = noCharacters; if (noCharacters) return; // Creates the controls var characters = new List<Character>(); if (Settings.UI.MainWindow.PutTrainingSkillsFirstOnOverview) { characters.AddRange(EveClient.MonitoredCharacters.Where(x => x.IsTraining)); characters.AddRange(EveClient.MonitoredCharacters.Where(x => !x.IsTraining)); } else { characters.AddRange(EveClient.MonitoredCharacters); } foreach (var character in characters) { // Creates a control and adds it var item = new OverviewItem(character, Settings.UI.MainWindow); item.Click += new EventHandler(item_Click); item.Clickable = true; // Ensure that the control gets created before we add it, // (when Overview is created and then we hide a character, // the control gets created after the custom layout has been performed, // causing the controls to get misplaced) item.CreateControl(); // Add it this.Controls.Add(item); } PerformCustomLayout(); } finally { this.ResumeLayout(); } }
/// <summary> /// Updates the characters' list with the provided monitors /// </summary> /// <param name="monitors"></param> public void UpdateContent() { this.SuspendLayout(); try { CleanUp(); if (EveClient.MonitoredCharacters.IsEmpty()) { // Updates the visibility of the label for when no characters are loaded labelNoCharacters.Visible = true; return; } // Creates the controls labelNoCharacters.Visible = false; var characters = new List <Character>(); characters.AddRange(EveClient.MonitoredCharacters.Where(x => x.IsTraining)); characters.AddRange(EveClient.MonitoredCharacters.Where(x => !x.IsTraining)); foreach (var character in characters) { // Creates a control and adds it var item = new OverviewItem(character, Settings.UI.MainWindow); item.Click += new EventHandler(item_Click); item.Clickable = true; // Add it this.Controls.Add(item); } PerformCustomLayout(); } finally { this.ResumeLayout(); } }
/// <summary> /// Recreates the controls for character and warning /// </summary> private void UpdateContent() { if (!this.Visible) { m_updatePending = true; return; } m_updatePending = false; IEnumerable <Character> characters = GetCharacters(); // Remove controls and dispose them var oldControls = mainPanel.Controls.Cast <Control>().ToArray(); mainPanel.Controls.Clear(); foreach (var ctl in oldControls) { ctl.Dispose(); } // Add controls for characters if (Settings.UI.SystemTrayPopup.GroupBy == TrayPopupGrouping.Account && Settings.UI.SystemTrayPopup.IndentGroupedAccounts) { long PrevUserID = 0; foreach (Character character in characters) { if (character.Identity.Account.UserID != PrevUserID) { mainPanel.Controls.Add(new OverviewItem(character, Settings.UI.SystemTrayPopup)); PrevUserID = character.Identity.Account.UserID; } else { FlowLayoutPanel AccountGroupPanel = new FlowLayoutPanel(); AccountGroupPanel.AutoSize = true; AccountGroupPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; AccountGroupPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; AccountGroupPanel.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0); OverviewItem charpanel = new OverviewItem(character, Settings.UI.SystemTrayPopup); charpanel.Padding = new System.Windows.Forms.Padding(0, 0, 0, 0); AccountGroupPanel.Controls.Add(charpanel); mainPanel.Controls.Add(AccountGroupPanel); PrevUserID = character.Identity.Account.UserID; } } } else { mainPanel.Controls.AddRange(characters.Select(x => new OverviewItem(x, Settings.UI.SystemTrayPopup)).ToArray()); } // Return if the user do not want to be warned about accounts not in training if (Settings.UI.SystemTrayPopup.ShowWarning) { // Creates the warning for accounts not in training string warningMessage; if (EveClient.Accounts.HasAccountsNotTraining(out warningMessage)) { FlowLayoutPanel warningPanel = CreateAccountsNotTrainingPanel(warningMessage); mainPanel.Controls.Add(warningPanel); } } // TQ Server Status if (Settings.UI.SystemTrayPopup.ShowServerStatus) { m_serverStatusLabel = new Label(); m_serverStatusLabel.AutoSize = true; mainPanel.Controls.Add(m_serverStatusLabel); UpdateServerStatusLabel(); } // EVE Time if (Settings.UI.SystemTrayPopup.ShowEveTime) { m_eveTimeLabel = new Label(); m_eveTimeLabel.AutoSize = true; mainPanel.Controls.Add(m_eveTimeLabel); UpdateEveTimeLabel(); } // Updates the tooltip width CompleteLayout(); }