コード例 #1
0
ファイル: Publisher.cs プロジェクト: verely/CSRep
        /// <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);
            }
        }
コード例 #2
0
 public void OnTime(TimeEventArgs args)
 {
     EventSubscription[] Subscriptions = SubscriptionsManager.GetSubscriptions(typeof(IApplicationEventsSink), "OnTime");
     foreach (EventSubscription sub in Subscriptions)
     {
         sub.DispatchEvent(args);
     }
 }
コード例 #3
0
ファイル: ApplicationEventSink.cs プロジェクト: verely/CSRep
 //[SecurityPermission(SecurityAction.LinkDemand)]
 public void OnTime(TimeEventArgs args)
 {
     Console.WriteLine(args.Time);
 }