예제 #1
0
        //============================================================================*
        // OnViewAmmo()
        //============================================================================*

        protected void OnViewAmmo(object sender, EventArgs args)
        {
            //----------------------------------------------------------------------------*
            // Get the selected object
            //----------------------------------------------------------------------------*

            ListViewItem Item = m_AmmoListView.SelectedItems[0];

            if (Item == null)
            {
                return;
            }

            cAmmo Ammo = (cAmmo)Item.Tag;

            if (Ammo == null)
            {
                return;
            }

            //----------------------------------------------------------------------------*
            // Start the dialog
            //----------------------------------------------------------------------------*

            Cursor = Cursors.WaitCursor;

            cAmmoForm AmmoForm = new cAmmoForm(Ammo, m_DataFiles, true);

            Cursor = Cursors.Default;

            AmmoForm.ShowDialog();

            m_AmmoListView.Focus();
        }
예제 #2
0
        //============================================================================*
        // OnEditAmmo()
        //============================================================================*

        protected void OnEditAmmo(object sender, EventArgs args)
        {
            //----------------------------------------------------------------------------*
            // Get the selected Firearm
            //----------------------------------------------------------------------------*

            ListViewItem Item = m_AmmoListView.SelectedItems[0];

            if (Item == null)
            {
                return;
            }

            cAmmo Ammo = (cAmmo)Item.Tag;

            if (Ammo == null)
            {
                return;
            }

            //----------------------------------------------------------------------------*
            // Start the dialog
            //----------------------------------------------------------------------------*

            Cursor = Cursors.WaitCursor;

            cAmmoForm AmmoForm = new cAmmoForm(Ammo, m_DataFiles);

            Cursor = Cursors.Default;

            if (AmmoForm.ShowDialog() == DialogResult.OK)
            {
                //----------------------------------------------------------------------------*
                // Get the new Firearm Data
                //----------------------------------------------------------------------------*

                cAmmo NewAmmo = AmmoForm.Ammo;
                m_DataFiles.Preferences.LastAmmo = AmmoForm.Ammo;

                UpdateAmmo(Ammo, NewAmmo);

                UpdateAmmoTabButtons();
            }

            m_AmmoListView.Focus();
        }
예제 #3
0
        //============================================================================*
        // OnAddAmmo()
        //============================================================================*

        protected void OnAddAmmo(object sender, EventArgs args)
        {
            //----------------------------------------------------------------------------*
            // Start the dialog
            //----------------------------------------------------------------------------*

            Cursor = Cursors.WaitCursor;

            cAmmoForm AmmoForm = new cAmmoForm(null, m_DataFiles);

            Cursor = Cursors.Default;

            if (AmmoForm.ShowDialog() == DialogResult.OK)
            {
                //----------------------------------------------------------------------------*
                // Get the new Firearm Data
                //----------------------------------------------------------------------------*

                cAmmo NewAmmo = AmmoForm.Ammo;
                m_DataFiles.Preferences.LastAmmo = AmmoForm.Ammo;

                m_AmmoListView.Focus();

                //----------------------------------------------------------------------------*
                // See if the ammo already exists
                //----------------------------------------------------------------------------*

                foreach (cAmmo CheckAmmo in m_DataFiles.AmmoList)
                {
                    if (CheckAmmo.CompareTo(NewAmmo) == 0)
                    {
                        return;
                    }
                }

                AddAmmo(NewAmmo);
            }
        }