Exemplo n.º 1
0
        //============================================================================*
        // Populate()
        //============================================================================*

        public void Populate(cLoad Load, cCharge SelectCharge)
        {
            Populating = true;

            //----------------------------------------------------------------------------*
            // Create the format strings
            //----------------------------------------------------------------------------*

            m_strPowderWeightFormat = m_DataFiles.Preferences.FormatString(cDataFiles.eDataType.PowderWeight);

            //----------------------------------------------------------------------------*
            // Reset the list view
            //----------------------------------------------------------------------------*

            Items.Clear();

            ListViewItem SelectItem = null;

            //----------------------------------------------------------------------------*
            // Loop through the charges
            //----------------------------------------------------------------------------*

            foreach (cCharge Charge in Load.ChargeList)
            {
                ListViewItem Item = AddCharge(Charge);

                if (Item != null && SelectCharge != null && SelectCharge.CompareTo(Charge) == 0)
                {
                    SelectItem = Item;
                }
            }

            Focus();

            //----------------------------------------------------------------------------*
            // Select a charge
            //----------------------------------------------------------------------------*

            if (SelectItem != null)
            {
                SelectItem.Selected = true;

                m_DataFiles.Preferences.LastChargeSelected = (cCharge)Items[0].Tag;

                EnsureVisible(SelectItem.Index);
            }
            else
            {
                if (Items.Count > 0)
                {
                    Items[0].Selected = true;

                    EnsureVisible(Items[0].Index);
                }
            }

            Populating = false;
        }
Exemplo n.º 2
0
        //============================================================================*
        // AddCharge()
        //============================================================================*

        public void AddCharge(cCharge NewCharge)
        {
            cCharge Charge = m_ChargeList.AddCharge(NewCharge);

            if (Charge.CompareTo(NewCharge) != 0)
            {
                foreach (cChargeTest ChargeTest in NewCharge.TestList)
                {
                    Charge.AddTest(ChargeTest);
                }
            }
        }
Exemplo n.º 3
0
        //============================================================================*
        // Comparer()
        //============================================================================*

        public static int Comparer(cCharge Charge1, cCharge Charge2)
        {
            if (Charge1 == null)
            {
                if (Charge2 != null)
                {
                    return(-1);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                if (Charge2 == null)
                {
                    return(1);
                }
            }

            return(Charge1.CompareTo(Charge2));
        }