예제 #1
0
        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);
        }
예제 #2
0
 static void PopulateRelay(Relay <int, float, string> rly)
 {
     for (int i = 0; i < DELEGATES; ++i)
     {
         rly.AddListener(allDelegates[i], true);
     }
 }
예제 #3
0
 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();
     }
 }
예제 #4
0
        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);
        }
예제 #5
0
 void SyncAddDelegate(int i, float f, bool b, uint u)
 {
     DummyDelegate1();
     myRelay4.AddListener(DummyDelegate2);
 }
예제 #6
0
 void SyncAddDelegate(int i, float f)
 {
     DummyDelegate1();
     myRelay2.AddListener(DummyDelegate2);
 }
예제 #7
0
 void SyncAddDelegate(int i)
 {
     DummyDelegate1();
     myRelay1.AddListener(DummyDelegate2);
 }
예제 #8
0
 public virtual void AddListener(Action listener)
 {
     onRaiseRelay.AddListener(listener);
 }
예제 #9
0
 public void AddListener(Action <T> listener)
 {
     onValueChanged.AddListener(listener);
 }