public FormBinderToolStrip()
 {
     _btnAddNew.Click += delegate(object sender, EventArgs e) { AddNew?.Invoke(this, e); };
     _btnSave.Click   += delegate(object sender, EventArgs e) { Save?.Invoke(this, e); };
     _btnDelete.Click += delegate(object sender, EventArgs e) { Delete?.Invoke(this, e); };
     Items.AddRange(new ToolStripItem[] { _btnAddNew, _btnSave, _btnDelete });
 }
Esempio n. 2
0
        private async void Save(object obj)
        {
            Product temp = new Product();

            temp.Name = _name;
            long i = new long();

            long.TryParse(_count, out i);
            temp.count            = i;
            temp.Unit             = _type;
            temp.Product_category = Cur_cat;
            _model.db.ProductSet.Add(temp);
            await _model.db.SaveChangesAsync();

            AddNew?.Invoke(obj, null);
            Clear();
            WpfMessageBox.Show("Добавление", "Продукты успешно добавлены!", MessageBoxType.Information);
        }