Example #1
0
        public Child()
        {
            Console.WriteLine("@ child| created");

            /*
             * MiddleMan.Outgoing += MiddleManOnOutgoing;
             * MiddleMan.Initialize += MiddleManOnInitialize;
             * MiddleMan.MonitoredOut += MiddleManOnMonitoredOut;
             * MiddleMan.NonMonitoredOut += MiddleMan_NonMonitoredOut;
             *
             */

            s0 = new SubChild();
            s0.ConfigListener(Program.INIT_EVT_NAME);

            s1 = new SubChild();
            s1.ConfigListener(Program.INIT_EVT_NAME);

            s2 = new SubChild();
            s2.ConfigListener(Program.INIT_EVT_NAME);

            Orator.Listen(Program.INIT_EVT_NAME, OnIntEvent);

            // Modified = Orator.GetAnnouncer(Program.MODIFY_EVT_NAME);
            Modified2 = Orator.GetAnnouncer2(this, Program.MODIFY_EVT_NAME);
        }
Example #2
0
        // private void AnnounceInit(object package)
        // {
        //  Orator.Announcer(this, INIT_EVT_NAME, package);
        // }


        //public void Test2()
        //{
        //	Console.WriteLine("\n@ program| Test 2\n");

        //	Orator.ConfRoom.Announcer A1 = Orator.GetAnnouncer("Alpha");

        //	Console.WriteLine("@ program| raise event Alpha1\n");
        //	A1.Announce(this, 1000);

        //	Orator.Listen("Alpha", OnAlphaEvent, "Alpha Description");
        //	Orator.Listen("Alpha", OnAlpha2Event, "Alpha Description");
        //	Orator.Listen("Beta", OnBetaEvent, "Beta Description");

        //	Orator.ConfRoom.Announcer A2 = Orator.GetAnnouncer("Alpha");

        //	Console.WriteLine("@ program| raise event Alpha1 & Alpha2\n");
        //	A1.Announce(this, 1000);
        //	A2.Announce(this, 2000);

        //	Orator.ConfRoom.Announcer B = Orator.GetAnnouncer("Beta");

        //	Console.WriteLine("@ program| raise event B\n");
        //	B.Announce(this, 500);

        //	string[,] rooms = Orator.ConferenceRooms();

        //	Console.WriteLine("@ program| list ********\n");
        //	for (int i = 0; i < rooms.GetLength(0); i++)
        //	{
        //		Console.Write("@ program| name| " + rooms[i,0]);
        //		Console.Write(" desc| " + rooms[i,1]);
        //		Console.Write(" List #| " + rooms[i,2]);
        //		Console.WriteLine(" Ann #| " + rooms[i,3]);
        //	}
        //}

        private void OnModifiedEvent(object sender, object value)
        {
            Console.WriteLine("@ program| Modified event received|  \""
                              + value.ToString()
                              + "\" sent by| " + sender.ToString());

            if (sender.GetType() == typeof(SubChild))
            {
                SubChild sc = sender as SubChild;

                Console.WriteLine("@ program| subchild message| " + sc.Message);
            }

            Console.WriteLine("");
        }