1. 接受變動通知者
範例1
frm物料更新.TrxStatusUpdateHandler m;
m = new frm物料更新.TrxStatusUpdateHandler(async delegate ()
{ try
{ while (!this.IsHandleCreated) {; }
if (IsHandleCreated)
DataGridView1.Invoke((MethodInvoker)UpdateDataGridView);
} catch (Exception ex) { LogWriter.ShowErrMsg(ex); }
}); frm物料更新.OnTrxStatusUpdated += m;
範例2
private void SubscribeNotification(frm雜項單建立 f) { f.OnTrxStatusUpdated += new frm雜項單建立.TrxStatusUpdateHandler(async delegate () { try { while (!this.IsHandleCreated) {; } if (IsHandleCreated) grid雜項單列表.Invoke((MethodInvoker)UpdateGrid雜項單列表); } catch (Exception ex) { LogWriter.ShowErrMsg(ex); } }); }
範例3
public void Subscribe選擇物料(frm選擇出庫物料_數量 f)
{ frm選擇出庫物料_數量.OnItemSelected w = new frm選擇出庫物料_數量.OnItemSelected(delegate (StkOutMaterial[] m, String srcFormName) { if (!this.Text.Equals(srcFormName)) return; dataGridView1.Update(); }); f.mItemSelected += w;
}
2. 發動變異通知者
範例1
public delegate void TrxStatusUpdateHandler() ;
或傳值 public delegate void TrxStatusUpdateHandler(SECS s) )
static public event TrxStatusUpdateHandler OnTrxStatusUpdated;
if (OnTrxStatusUpdated != null)
{ OnTrxStatusUpdated() ; }
3. 檢查cancel form
(按下確認前都須canceled=false)
按下取消前 都須canceled =false
沒有留言:
張貼留言