public EditBuild(Data.GunBuild b)
 {
     build = b;
     InitializeComponent();
     loadDropdowns();
     ClearAllInputs();
     loadBuild();
 }
        ///Save Method Group End


        //delete selected row
        private void DeleteSelected(object sender, EventArgs e)
        {
            if (BuildGridView.SelectedCells.Count == 0)
            {
                MessageBox.Show("Must Select A Row First");
                return;
            }
            Data.GunBuild b = GunBuildsDisplayed[BuildGridView.SelectedCells[0].RowIndex];
            if (MessageBox.Show("Are you sure you want to delete \"" + b.Name + "\"?", "Delete class", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
            {
                Data.RemoveGunBuild(b);
            }
            RefreshTable();
        }
        private void updateBuild()
        {
            bool toadd = false;

            if (build == null)
            {
                toadd = true;
                build = new Data.GunBuild("", null, null, null, null, null, null, null, null, null, false);
            }
            build.Optic  = Data.GetAttachmentByName(OpticCombo.SelectedItem.ToString());
            build.Muzzle = Data.GetAttachmentByName(MuzzleCombo.SelectedItem.ToString());
            //Console.WriteLine(Data.GetAttachmentByName(BarrelCombo.SelectedItem.ToString()));
            build.Barrel      = Data.GetAttachmentByName(BarrelCombo.SelectedItem.ToString());
            build.Body        = Data.GetAttachmentByName(BodyCombo.SelectedItem.ToString());
            build.Underbarrel = Data.GetAttachmentByName(UnderbarrelCombo.SelectedItem.ToString());
            build.Magazine    = Data.GetAttachmentByName(MagazineCombo.SelectedItem.ToString());
            build.Handle      = Data.GetAttachmentByName(HandleCombo.SelectedItem.ToString());
            build.Stock       = Data.GetAttachmentByName(StockCombo.SelectedItem.ToString());
            build.GunClass    = Data.GetGunByName(GunCombo.SelectedItem.ToString());
            build.Favorite    = FavoriteCheckBox.Checked;
            build.Name        = NameBox.Text;
            //if (toadd)
            Data.AddGunBuild(build);
        }
Esempio n. 4
0
 public BuildViewer(Data.GunBuild build)
 {
     InitializeComponent();
     Build = build;
 }