private void butAddCat_Click(object sender, System.EventArgs e) { QuickPasteCat quickCat = new QuickPasteCat(); FormQuickPasteCat FormQ = new FormQuickPasteCat(quickCat); FormQ.ShowDialog(); if (FormQ.DialogResult != DialogResult.OK) { return; } quickCat = FormQ.QuickCat; QuickPasteCats.Insert(quickCat); _hasChanges = true; //We are doing this so tha when the sync is called in FormQuickPaste_FormClosing(...) we do not re-insert. //For now the sync will still detect a change due to the item orders. _listCatsOld.Add(quickCat.Copy()); if (listCat.SelectedIndex != -1) { _listCats.Insert(listCat.SelectedIndex, quickCat); //insert at selectedindex AND selects new category when we refill grid below. } else //Will only happen if they do not have any categories. { _listCats.Add(quickCat); //add to bottom of list, will be selected when we fill grid below. } FillCats(); FillMain(); }
///<summary>The QuickPasteCat passed into this constructor is directly manipulated.</summary> public FormQuickPasteCat(QuickPasteCat quickCat) { QuickCat = quickCat.Copy(); // // Required for Windows Form Designer support // InitializeComponent(); Lan.F(this); }