예제 #1
0
파일: Program.cs 프로젝트: kuskmen/Random
        static void Main(string[] args)
        {
            ApplicationStartHandler ah  = new ApplicationStartHandler(ApplicationStarted);
            ApplicationStartHandler ah1 = new ApplicationStartHandler(DoStuff);
            ApplicationStartHandler ah2 = new ApplicationStartHandler(HelloWorld);

            // smart
            ah += ah1 + ah2;

            ah.Invoke(Environment.MachineName);


            OopsApplicationStartHandler oah  = new OopsApplicationStartHandler(OopsMethod);
            OopsApplicationStartHandler oah1 = new OopsApplicationStartHandler(OopsMethod2);
            OopsApplicationStartHandler oah2 = new OopsApplicationStartHandler(OopsMethod3);

            // Not so smart...
            oah += oah1 + oah2;
            Console.WriteLine(oah.Invoke());


            // Wut did I just did ? o.O
            //if (oah.Target == null)
            //{
            //    Console.WriteLine(oah.Target);
            //}

            //Console.WriteLine(null);
        }
예제 #2
0
파일: Program.cs 프로젝트: kuskmen/Random
        public static void OnApplicationStart(string str)
        {
            ApplicationStartHandler del = ApplicationStart as ApplicationStartHandler;

            del?.Invoke(str);
        }
예제 #3
0
파일: Program.cs 프로젝트: kuskmen/Random
        static void Main(string[] args)
        {
            ApplicationStartHandler ap = new ApplicationStartHandler(ApplicationStarted);

            ap.Invoke(Environment.MachineName);
        }