public void BindPressEvent(MultiEventObserver binder, Action <object, EventArgs> action) { var id = binder.AddNewEventAndSubscribeMethodToIt(action); onPressedInBind.SubscribeEventHandlerMethod("bindpress", _ => binder.InvokeEvent(id, this, new SimpleEventArgs(_))); onUnbind += () => UnbindPressEvent(binder, id); }
private void BindSelectionEvent(MultiEventObserver binder, Action <object, EventArgs> action, Unit u) { if (!trackedUnitsBinders.ContainsKey(u)) { var id = binder.AddNewEventAndSubscribeMethodToIt(action); u.GetOnSelectionStateChangeObserver().SubscribeEventHandlerMethod("doactiontreeview", _ => { if (_.Item3 == 0) { binder.InvokeEvent(id, u, null); } }); trackedUnitsBinders.Add(u, binder); } }
private void BindTaskSelectionEvent(MultiEventObserver binder, Action <object, EventArgs> action) { var id = binder.AddNewEventAndSubscribeMethodToIt(action); GetOnSelectionStateChangeObserver().SubscribeEventHandlerMethod("whateverkey", _ => { if (_.Item3 == 0) { binder.InvokeEvent(id, this, new SimpleEventArgs(_.Item2)); } }, true); }