Beispiel #1
0
 /// <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);
 }
Beispiel #2
0
 protected virtual void Execute(DataRowActionType eventType, DataRow r, object sender, EventArgs args)
 {
     if (Handler != null)
     {
         Handler(new DataRowTriggerEventArgs(eventType, r, sender, args));
     }
 }
Beispiel #3
0
 public DataRowTriggerEventArgs(DataRowActionType action, DataRow r, object sender, EventArgs args)
 {
     Action = action;
     Row    = r;
     Sender = sender;
     Args   = args;
 }
Beispiel #4
0
 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);
 }
Beispiel #5
0
 /// <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)
 {
 }