object CreateSyncAddSelfRemRelay(int args, bool addListenerBefore) { object r = null; switch (args) { case 0: myRelay = new Relay(); if (addListenerBefore) { myRelay.AddListener(DummyDelegate1); } myRelay.AddListener(SyncAddSelfRemDelegate); r = myRelay; break; case 1: myRelay1 = new Relay <int>(); if (addListenerBefore) { myRelay1.AddListener(DummyDelegate1); } myRelay1.AddListener(SyncAddSelfRemDelegate); r = myRelay1; break; case 2: myRelay2 = new Relay <int, float>(); if (addListenerBefore) { myRelay2.AddListener(DummyDelegate1); } myRelay2.AddListener(SyncAddSelfRemDelegate); r = myRelay2; break; case 3: myRelay3 = new Relay <int, float, bool>(); if (addListenerBefore) { myRelay3.AddListener(DummyDelegate1); } myRelay3.AddListener(SyncAddSelfRemDelegate); r = myRelay3; break; case 4: myRelay4 = new Relay <int, float, bool, uint>(); if (addListenerBefore) { myRelay4.AddListener(DummyDelegate1); } myRelay4.AddListener(SyncAddSelfRemDelegate); r = myRelay4; break; } return(r); }
static void PopulateRelay(Relay <int, float, string> rly) { for (int i = 0; i < DELEGATES; ++i) { rly.AddListener(allDelegates[i], true); } }
static void PopulateRelaySlowTimed(Relay <int, float, string> rly) { for (int i = 0; i < DELEGATES; ++i) { var d = allDelegates[i]; sw.Start(); rly.AddListener(d); sw.Stop(); } }
object CreateSyncAddRelay(int args) { object r = null; switch (args) { case 0: myRelay = new Relay(); myRelay.AddListener(SyncAddDelegate); r = myRelay; break; case 1: myRelay1 = new Relay <int>(); myRelay1.AddListener(SyncAddDelegate); r = myRelay1; break; case 2: myRelay2 = new Relay <int, float>(); myRelay2.AddListener(SyncAddDelegate); r = myRelay2; break; case 3: myRelay3 = new Relay <int, float, bool>(); myRelay3.AddListener(SyncAddDelegate); r = myRelay3; break; case 4: myRelay4 = new Relay <int, float, bool, uint>(); myRelay4.AddListener(SyncAddDelegate); r = myRelay4; break; } return(r); }
void SyncAddDelegate(int i, float f, bool b, uint u) { DummyDelegate1(); myRelay4.AddListener(DummyDelegate2); }
void SyncAddDelegate(int i, float f) { DummyDelegate1(); myRelay2.AddListener(DummyDelegate2); }
void SyncAddDelegate(int i) { DummyDelegate1(); myRelay1.AddListener(DummyDelegate2); }
public virtual void AddListener(Action listener) { onRaiseRelay.AddListener(listener); }
public void AddListener(Action <T> listener) { onValueChanged.AddListener(listener); }