//============================================================================*
        // cLoadEvaluationForm() - Constructor
        //============================================================================*

        public cLoadEvaluationForm(cDataFiles DataFiles, cLoadList LoadList)
        {
            InitializeComponent();

            m_DataFiles = DataFiles;
            m_LoadList  = LoadList;

            //----------------------------------------------------------------------------*
            // Event Handlers
            //----------------------------------------------------------------------------*

            FactoryTestRadioButton.Click += OnFactoryTestClicked;

            CaliberCombo.SelectedIndexChanged += OnCaliberSelected;

            BulletCombo.SelectedIndexChanged += OnBulletSelected;
            CaseCombo.SelectedIndexChanged   += OnCaseSelected;
            PowderCombo.SelectedIndexChanged += OnPowderSelected;
            PrimerCombo.SelectedIndexChanged += OnPrimerSelected;

            SetClientSizeCore(FiltersGroupBox.Location.X + FiltersGroupBox.Width + 10, CloseButton.Location.Y + CloseButton.Height + 20);

            //----------------------------------------------------------------------------*
            // Populate Combo Boxes
            //----------------------------------------------------------------------------*

            PopulateComboBoxes();

            //----------------------------------------------------------------------------*
            // Create and Populate Evaluation List
            //----------------------------------------------------------------------------*

            m_EvaluationListView = new cEvaluationListView(m_DataFiles, m_LoadList);

            Controls.Add(m_EvaluationListView);

            m_EvaluationListView.Populate();

            //----------------------------------------------------------------------------*
            // Update Buttons and Exit
            //----------------------------------------------------------------------------*

            m_fInitialized = true;

            if (m_DataFiles.Preferences.EvaluationListSize.Width != 0 && m_DataFiles.Preferences.EvaluationListSize.Height != 0)
            {
                Size = m_DataFiles.Preferences.EvaluationListSize;
            }

            if (m_DataFiles.Preferences.EvaluationListLocation.X != 0 && m_DataFiles.Preferences.EvaluationListLocation.Y != 0)
            {
                Location = m_DataFiles.Preferences.EvaluationListLocation;
            }

            SetControlPositions();

            UpdateButtons();
        }
Пример #2
0
        //============================================================================*
        // OnEvaluateLoad()
        //============================================================================*

        protected void OnEvaluateLoad(Object sender, EventArgs args)
        {
            cLoadList LoadList = new cLoadList();

            foreach (ListViewItem Item in m_LoadDataListView.CheckedItems)
            {
                cLoad Load = (cLoad)Item.Tag;

                LoadList.AddLoad(Load);
            }

            cLoadEvaluationForm Form = new cLoadEvaluationForm(m_DataFiles, LoadList);

            DialogResult rc = Form.ShowDialog();
        }
Пример #3
0
        //============================================================================*
        // cEvaluationListView() - Constructor
        //============================================================================*

        public cEvaluationListView(cDataFiles DataFiles, cLoadList LoadList, bool fFactoryTest = false, bool fAmmo = false)
            : base(DataFiles, cPreferences.eApplicationListView.LoadDataListView)
        {
            m_DataFiles = DataFiles;

            m_LoadList = LoadList;

            m_fFactoryTest = fFactoryTest;
            m_fAmmo        = fAmmo;

            //----------------------------------------------------------------------------*
            // Set Properties
            //----------------------------------------------------------------------------*

            AllowColumnReorder = false;
            CheckBoxes         = false;

            //----------------------------------------------------------------------------*
            // Event Handlers
            //----------------------------------------------------------------------------*

            ListViewItemSorter = new cListViewEvaluationComparer(m_DataFiles, m_DataFiles.Preferences.EvaluationSortColumn, m_DataFiles.Preferences.EvaluationSortOrder);

            //----------------------------------------------------------------------------*
            // Populate Columns and Groups
            //----------------------------------------------------------------------------*

            PopulateColumns(m_arColumns);

            SortingOrder = m_DataFiles.Preferences.EvaluationSortOrder;

            SortingColumn = m_DataFiles.Preferences.EvaluationSortColumn;

            Populate();

            Initialized = true;
        }
Пример #4
0
        //============================================================================*
        // CreateShareFile()
        //============================================================================*

        private void CreateShareFile()
        {
            //----------------------------------------------------------------------------*
            // Gather all the needed info to store the loads to be shared
            //----------------------------------------------------------------------------*

            cManufacturerList ShareManufacturerList = new cManufacturerList();
            cCaliberList      ShareCaliberList      = new cCaliberList();
            cBulletList       ShareBulletList       = new cBulletList();
            cCaseList         ShareCaseList         = new cCaseList();
            cPowderList       SharePowderList       = new cPowderList();
            cPrimerList       SharePrimerList       = new cPrimerList();

            cLoadList ShareLoadList = new cLoadList();

            foreach (ListViewItem Item in m_LoadDataListView.CheckedItems)
            {
                cLoad Load = (cLoad)Item.Tag;

                if (Load != null && Load.Bullet != null && Load.Case != null && Load.Powder != null && Load.Primer != null)
                {
                    foreach (cBulletCaliber BulletCaliber in Load.Bullet.BulletCaliberList)
                    {
                        ShareCaliberList.AddCaliber(BulletCaliber.Caliber);
                    }

                    ShareManufacturerList.AddManufacturer(Load.Bullet.Manufacturer);
                    ShareBulletList.AddBullet(Load.Bullet);

                    ShareManufacturerList.AddManufacturer(Load.Case.Manufacturer);
                    ShareCaseList.AddCase(Load.Case);

                    ShareManufacturerList.AddManufacturer(Load.Powder.Manufacturer);
                    SharePowderList.AddPowder(Load.Powder);

                    ShareManufacturerList.AddManufacturer(Load.Primer.Manufacturer);
                    SharePrimerList.AddPrimer(Load.Primer);

                    ShareLoadList.Add(Load);
                }
            }

            //----------------------------------------------------------------------------*
            // Now create a cRWXMLDocument and export the load data to it
            //----------------------------------------------------------------------------*

            cRWXMLDocument XMLDocument = new cRWXMLDocument(m_DataFiles);

            XmlElement MainElement = XMLDocument.CreateElement("Body");

            XMLDocument.AppendChild(MainElement);

            XmlText XMLTextElement = XMLDocument.CreateTextNode(String.Format("{0} Load Data Share File Export", Application.ProductName));

            MainElement.AppendChild(XMLTextElement);

            ShareManufacturerList.Export(XMLDocument, MainElement);
            ShareBulletList.Export(XMLDocument, MainElement, false);
            ShareCaliberList.Export(XMLDocument, MainElement);
            ShareCaseList.Export(XMLDocument, MainElement, false);
            SharePowderList.Export(XMLDocument, MainElement, false);
            SharePrimerList.Export(XMLDocument, MainElement, false);

            ShareLoadList.Export(XMLDocument, MainElement);

            //----------------------------------------------------------------------------*
            // Save the Exported XML Share File
            //----------------------------------------------------------------------------*

            SaveFileDialog SaveDialog = new SaveFileDialog();

            SaveDialog.AddExtension     = true;
            SaveDialog.CheckPathExists  = true;
            SaveDialog.DefaultExt       = "xml";
            SaveDialog.FileName         = String.Format("{0} Load Data Share File - {1}{2}{3}", Application.ProductName, DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
            SaveDialog.Filter           = "XML Files {*.xml)|*.xml";
            SaveDialog.InitialDirectory = Path.Combine(m_DataFiles.GetDataPath(), "Share");
            SaveDialog.OverwritePrompt  = true;
            SaveDialog.Title            = String.Format("Export Load Data");
            SaveDialog.ValidateNames    = true;

            if (SaveDialog.ShowDialog() == DialogResult.OK)
            {
                XMLDocument.Save(SaveDialog.OpenFile());
            }
        }