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();
     }
 }
예제 #3
0
 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);
     }
 }
예제 #4
0
 public async void OnChooseEvent(SortableJSEvent e)
 {
     await OnChoose.InvokeAsync(new SortableEvent <TItem>(this, e));
 }
예제 #5
0
 /// <summary>
 /// 传出被选中的消息
 /// </summary>
 /// <param name="card">卡片</param>
 protected void Choose(ChoosableCard card)
 {
     OnChoose?.Invoke(card);
 }