/// <summary> /// Initializes new instance of DataRowTrigger with specified row action, table name, handler and subscribes it to appropriate data events. /// </summary> /// <param name="rowAction">row action flags</param> /// <param name="tableName">table name to match</param> /// <param name="handler">handler delegate</param> /// <param name="broker">data events broker</param> public DataRowTrigger(DataRowActionType rowAction, string tableName, Action <DataRowTriggerEventArgs> handler, DataEventBroker broker) { TableName = tableName; Action = rowAction; Handler = handler; SubscribeForEvents(broker); }
protected virtual void Execute(DataRowActionType eventType, DataRow r, object sender, EventArgs args) { if (Handler != null) { Handler(new DataRowTriggerEventArgs(eventType, r, sender, args)); } }
public DataRowTriggerEventArgs(DataRowActionType action, DataRow r, object sender, EventArgs args) { Action = action; Row = r; Sender = sender; Args = args; }
protected virtual bool IsMatch(DataRow r, DataRowActionType eventType) { // event if ((Action & eventType) != eventType) { return(false); } // table name if (TableName != null && TableName != r.Table.TableName) { return(false); } return(true); }
/// <summary> /// Initializes new instance of DataRowTrigger with specified row action, table name and handler /// </summary> /// <param name="rowAction">row action flags</param> /// <param name="tableName">table name to match</param> /// <param name="handler">handler delegate</param> public DataRowTrigger(DataRowActionType rowAction, string tableName, Action <DataRowTriggerEventArgs> handler) : this(rowAction, tableName, handler, null) { }