public void AddPowder(string PowderName) { string lPwdrID; bool lLoaded = false; lPwdrID = LawlerBallisticsFactory.GetPowderID(PowderName); if (SelectedCartridge.PowderIDlist != null) { foreach (string lp in SelectedCartridge.PowderIDlist) { if (lp == lPwdrID) { lLoaded = true; break; } } } if (!lLoaded) { SelectedCartridge.PowderIDlist.Add(lPwdrID); } SelectedCartridge.Refresh(); RaisePropertyChanged(nameof(SelectedCartridgePowderList)); }
private void PwdrKeyUp(System.Windows.Input.KeyEventArgs e) { try { switch (e.Key) { case System.Windows.Input.Key.Delete: string lmsg = "Delete the selected powder option?"; string lcaption = "Delete Cartridge Powder Option"; MessageBoxButtons lbtns = MessageBoxButtons.YesNo; DialogResult lrst = MessageBox.Show(lmsg, lcaption, lbtns, MessageBoxIcon.Warning); if (lrst == DialogResult.Yes) { foreach (string lp in SelectedCartridge.PowderIDlist) { if (LawlerBallisticsFactory.GetPowderName(lp) == SelectedCartridgePowderName) { SelectedCartridge.PowderIDlist.Remove(lp); break; } } } SelectedCartridge.Refresh(); RaisePropertyChanged(nameof(SelectedCartridge)); RaisePropertyChanged(nameof(SelectedCartridgePowderList)); break; case System.Windows.Input.Key.OemPlus: break; } } catch { } }