Пример #1
0
        private void KeyUp(System.Windows.Input.KeyEventArgs e)
        {
            try
            {
                switch (e.Key)
                {
                case System.Windows.Input.Key.Delete:
                    string            lmsg     = "Delete the selected powder?";
                    string            lcaption = "Delete Powder Data";
                    MessageBoxButtons lbtns    = MessageBoxButtons.YesNo;
                    DialogResult      lrst     = System.Windows.Forms.MessageBox.Show(lmsg, lcaption, lbtns, MessageBoxIcon.Warning);
                    if (lrst == DialogResult.Yes)
                    {
                        foreach (Powder lc in MyPowders)
                        {
                            if (SelectedPowder.ID == lc.ID)
                            {
                                MyPowders.Remove(lc);
                                SelectedPowder = null;
                                break;
                            }
                        }
                    }
                    break;

                case System.Windows.Input.Key.OemPlus:
                    AddPowder();
                    break;
                }
            }
            catch
            {
            }
        }
Пример #2
0
        private void SavePowder()
        {
            bool ls = false;

            foreach (Powder lItr in MyPowders)
            {
                if (lItr.ID == _SelectedPowder.ID)
                {
                    ls = true;
                    break;
                }
            }
            if (!ls)
            {
                MyPowders.Add(_SelectedPowder);
            }
            _frmPowder.Close();
            RaisePropertyChanged(nameof(MyPowders));
            RaisePropertyChanged(nameof(SelectedPowder));
        }