private void DisplayActivePage() { pnlClaimControls.SuspendLayout(); pnlClaimControls.AutoScroll = false; EndAllActiveCalls(); ClearAllClaims(); string lastGroupName = "|InvalidGroupName|"; ctlMultiClaimCallLabel lastLabel = null; if (cmbPage.SelectedIndex >= 0) { for (int i = cmbPage.SelectedIndex * 20; i < cmbPage.SelectedIndex * 20 + 20; i++) { if (_currentClaims.Count > i) { // Check to see if we have a new group. If so, we need a label as well if (_currentClaims[i].subscriber_group_name != lastGroupName) { lastLabel = AddLabel(_currentClaims[i].LinkedCompany.name, _currentClaims[i].subscriber_group_name); lastGroupName = _currentClaims[i].subscriber_group_name; } AddClaim(_currentClaims[i]); lastLabel.TryAddPhone(_currentClaims[i].LinkedCompanyAddress.phone); } else { int currentIndex = i - (cmbPage.SelectedIndex * 20); if (currentClaimControls.Count > currentIndex) { currentClaimControls[currentIndex].Visible = false; } } } } else { ClearAllClaims(true); } pnlClaimControls.AutoScroll = true; pnlClaimControls.ResumeLayout(); ResizeControls(); }
private ctlMultiClaimCallLabel AddLabel(string companyName, string groupName) { if (groupName == "") { groupName = "(No Group)"; } int defaultX = 0; int defaultY = 6; int top; if (_controlCount > 0) { top = currentAllControls[_controlCount - 1].Top + currentAllControls[_controlCount - 1].Height + SPACER; } else { top = defaultY; } ctlMultiClaimCallLabel toAdd = new ctlMultiClaimCallLabel(); pnlClaimControls.Controls.Add(toAdd); toAdd.Location = new System.Drawing.Point(defaultX, top); toAdd.Name = "lblGroupNameDisplay" + _controlCount; toAdd.Size = new System.Drawing.Size(pnlClaimControls.Width, 20); toAdd.Font = new System.Drawing.Font("Arial", 8.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); toAdd.BackColor = System.Drawing.SystemColors.ButtonHighlight; toAdd.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; toAdd.Padding = new System.Windows.Forms.Padding(10, 0, 5, 0); toAdd.GroupName = groupName; toAdd.Company_Name = companyName; currentAllControls.Add(toAdd); _controlCount++; return(toAdd); }