private void cmdStartPurchase_Click(object sender, EventArgs e) { if (_purchaseTransactionControl != null) { _purchaseTransactionControl.Show(); return; } _purchaseTransactionControl = Program.NinjectKernel.Get <PurchaseTransactionControl>(); _purchaseTransactionControl.TransactionCanceled += PurchaseTransactionControl_TransactionCanceled; _purchaseTransactionControl.TransactionCompleted += PurchaseTransactionControl_TransactionCompleted; pnlUserControl.Controls.Add(_purchaseTransactionControl); }
private void PurchaseTransactionControl_TransactionCanceled(object sender, EventArgs e) { pnlUserControl.Controls.Remove(_purchaseTransactionControl); UnwirePurchaseTransactionControl(); _purchaseTransactionControl = null; }