Ejemplo n.º 1
0
        /// <summary>
        /// The publisher's long running event dispatch procedure
        /// </summary>
        static void ThreadProc()
        {
            ApplicationEventsSink appEvents = new ApplicationEventsSink();

            int count = 0;

            while (!stopEvent.WaitOne(0, true))
            {
                Thread.Sleep(2000);

                if (stopEvent.WaitOne(0, true))
                {
                    break;
                }

                count++;
                if ((count % 5) == 0)
                {
                    // fire the OnClick event
                    ClickEventArgs onClick = new ClickEventArgs(count);
                    appEvents.OnClick(onClick);
                    Console.WriteLine(onClick.Value);
                }

                // fire the OnTime event
                TimeEventArgs onTime = new TimeEventArgs(DateTime.Now);
                appEvents.OnTime(onTime);
                Console.WriteLine(onTime.Time);
            }
        }
Ejemplo n.º 2
0
 public void OnTime(TimeEventArgs args)
 {
     EventSubscription[] Subscriptions = SubscriptionsManager.GetSubscriptions(typeof(IApplicationEventsSink), "OnTime");
     foreach (EventSubscription sub in Subscriptions)
     {
         sub.DispatchEvent(args);
     }
 }
Ejemplo n.º 3
0
 //[SecurityPermission(SecurityAction.LinkDemand)]
 public void OnTime(TimeEventArgs args)
 {
     Console.WriteLine(args.Time);
 }