//============================================================================* // cShoppingListPreviewDialog() - Constructor //============================================================================* public cLoadShoppingListPreviewDialog(cDataFiles DataFiles) { m_DataFiles = DataFiles; if (m_DataFiles.Preferences.ShoppingListPreviewMaximized) { WindowState = FormWindowState.Maximized; } else { Location = m_DataFiles.Preferences.ShoppingListPreviewLocation; ClientSize = m_DataFiles.Preferences.ShoppingListPreviewSize; } Text = String.Format("{0} Load Shopping List - Print Preview", Application.ProductName); PrintDocument ShoppingListDocument = new PrintDocument(); ShoppingListDocument.PrintPage += OnPrintPage; Document = ShoppingListDocument; UseAntiAlias = true; //----------------------------------------------------------------------------* // Set can weight for powder list header //----------------------------------------------------------------------------* m_PowderColumns[3].Name += String.Format(" ({0}s)", cDataFiles.MetricString(cDataFiles.eDataType.CanWeight)); //----------------------------------------------------------------------------* // Gather the list of supplies needed for the checked loads //----------------------------------------------------------------------------* m_SupplyList = new cSupplyList(); foreach (cLoad Load in m_DataFiles.LoadList) { if (Load.Checked) { if (!m_SupplyList.Contains(Load.Bullet)) { m_SupplyList.AddSupply(Load.Bullet); } if (!m_SupplyList.Contains(Load.Powder)) { m_SupplyList.AddSupply(Load.Powder); } if (!m_SupplyList.Contains(Load.Primer)) { m_SupplyList.AddSupply(Load.Primer); } if (!m_SupplyList.Contains(Load.Case)) { m_SupplyList.AddSupply(Load.Case); } } } ResetPrintedFlag(); m_fInitialized = true; }
//============================================================================* // SupplyList() //============================================================================* public cSupplyList SupplyList() { cSupplyList SupplyList = new cSupplyList(); // Bullets if (m_fBullets) { foreach (cSupply Supply in m_DataFiles.BulletList) { if (Supply.TransactionList.Count == 0) { continue; } bool fTransactionFound = false; foreach (cTransaction Transaction in Supply.TransactionList) { if (IncludeTransaction(Transaction)) { fTransactionFound = true; break; } } if (fTransactionFound) { if (!SupplyList.Contains(Supply)) { SupplyList.AddSupply(Supply); } } } } // Cases if (m_fCases) { foreach (cSupply Supply in m_DataFiles.CaseList) { if (Supply.TransactionList.Count == 0) { continue; } bool fTransactionFound = false; foreach (cTransaction Transaction in Supply.TransactionList) { if (IncludeTransaction(Transaction)) { fTransactionFound = true; break; } } if (fTransactionFound) { if (!SupplyList.Contains(Supply)) { SupplyList.AddSupply(Supply); } } } } // Powder if (m_fPowder) { foreach (cSupply Supply in m_DataFiles.PowderList) { if (Supply.TransactionList.Count == 0) { continue; } bool fTransactionFound = false; foreach (cTransaction Transaction in Supply.TransactionList) { if (IncludeTransaction(Transaction)) { fTransactionFound = true; break; } } if (fTransactionFound) { if (!SupplyList.Contains(Supply)) { SupplyList.AddSupply(Supply); } } } } // Primers if (m_fPrimers) { foreach (cSupply Supply in m_DataFiles.PrimerList) { if (Supply.TransactionList.Count == 0) { continue; } bool fTransactionFound = false; foreach (cTransaction Transaction in Supply.TransactionList) { if (IncludeTransaction(Transaction)) { fTransactionFound = true; break; } } if (fTransactionFound) { if (!SupplyList.Contains(Supply)) { SupplyList.AddSupply(Supply); } } } } // Ammo if (m_fReloads || m_fAmmo) { foreach (cSupply Supply in m_DataFiles.AmmoList) { if (Supply.TransactionList.Count == 0) { continue; } bool fTransactionFound = false; foreach (cTransaction Transaction in Supply.TransactionList) { if (IncludeTransaction(Transaction)) { fTransactionFound = true; break; } } if (fTransactionFound) { if (!SupplyList.Contains(Supply)) { SupplyList.AddSupply(Supply); } } } } return(SupplyList); }