private void SubstituteProduct_FormClosing(object sender, FormClosingEventArgs e) { if (!havechosen) { OnChoose?.Invoke(this, null); } }
private void chooseBtn_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to choose this item?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { using (var p = new POSEntities()) { var controlnum = varTable.SelectedCells[0].Value; var prod = p.Products.FirstOrDefault(x => x.Id == (int)controlnum); OnChoose?.Invoke(this, prod); havechosen = true; } this.Close(); } }
public OptionControl(string text, string details, object[] choices) { this.details = details; InitializeComponent(); label1.Text = text; foreach (var item in choices) { var b = new Button() { Text = item.ToString(), Margin = new Padding(50, 5, 50, 5), Size = new Size(96, 32) }; b.Click += (s, e) => { OnChoose?.Invoke(item); }; flowLayoutPanel1.Controls.Add(b); } }
public async void OnChooseEvent(SortableJSEvent e) { await OnChoose.InvokeAsync(new SortableEvent <TItem>(this, e)); }
/// <summary> /// 传出被选中的消息 /// </summary> /// <param name="card">卡片</param> protected void Choose(ChoosableCard card) { OnChoose?.Invoke(card); }