当前位置: 首页>>代码示例>>C#>>正文


C# EventQueue类代码示例

本文整理汇总了C#中EventQueue的典型用法代码示例。如果您正苦于以下问题:C# EventQueue类的具体用法?C# EventQueue怎么用?C# EventQueue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EventQueue类属于命名空间,在下文中一共展示了EventQueue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EventPumpQueueLength

        public void EventPumpQueueLength(int numberOfProducers, bool producerDelay)
        {
            EventQueue q = new EventQueue();
            EventProducer[] producers = new EventProducer[numberOfProducers];
            for (int i = 0; i < numberOfProducers; i++)
            {
                producers[i] = new EventProducer(q, i, producerDelay);
            }

            using (EventPump pump = new EventPump(NullListener.NULL, q, false))
            {
                pump.Name = "EventPumpQueueLength";
                pump.Start();

                foreach (EventProducer p in producers)
                {
                    p.ProducerThread.Start();
                }
                foreach (EventProducer p in producers)
                {
                    p.ProducerThread.Join();
                }
                pump.Stop();
            }
            Assert.That(q.Count, Is.EqualTo(0));

            foreach (EventProducer p in producers)
            {
                Console.WriteLine(
                    "#Events: {0}, MaxQueueLength: {1}", p.SentEventsCount, p.MaxQueueLength);
                Assert.IsNull(p.Exception, "{0}", p.Exception);
            }
        }
开发者ID:scottwis,项目名称:eddie,代码行数:33,代码来源:EventQueueTests.cs

示例2: EventList

 public EventList(EventQueue<string> events)
 {
     InitializeComponent();
     EventQueue = events;
     EventQueue.Updated += Events_Updated;
     ReloadEvents();
 }
开发者ID:Quackmatic,项目名称:VisualTrillek,代码行数:7,代码来源:EventList.cs

示例3: EventManager

        /**
	     * EventManager constructor comment.
	     *
	     * @param robotProxy robotProxy
	     */

        public EventManager(BasicRobotProxy robotProxy)
        {
            registerNamedEvents();
            this.robotProxy = robotProxy;
            eventQueue = new EventQueue();

            reset();
        }
开发者ID:jccjames422,项目名称:SRE-RoboCode,代码行数:14,代码来源:EventManager.cs

示例4: EventManager

        /// <summary>
        /// Constructs a new EventManager.
        /// </summary>
        /// <param name="robotProxy">the robot proxy that this event manager applies to.</param>
        public EventManager(BasicRobotProxy robotProxy)
        {
            this.robotProxy = robotProxy;
            eventQueue = new EventQueue();

            RegisterEventNames();
            Reset();
        }
开发者ID:Chainie,项目名称:robocode,代码行数:12,代码来源:EventManager.cs

示例5: Environment

 public Environment(DateTime initialDateTime, int randomSeed, TimeSpan? defaultStep = null) {
   DefaultTimeStepSeconds = (defaultStep ?? TimeSpan.FromSeconds(1)).Duration().TotalSeconds;
   StartDate = initialDateTime;
   Now = initialDateTime;
   Random = new SystemRandom(randomSeed);
   ScheduleQ = new EventQueue(InitialMaxEvents);
   Queue = new Queue<Event>();
   Logger = Console.Out;
 }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:9,代码来源:Environment.cs

示例6: Server

 /// <summary>
 /// start a small server that listens to UDP messages through _port 1337(as indicated when initializing the server instance).
 /// </summary>
 /// <param name="_port"></param>
 public Server(int _port)
 {
     this._iPort = _port;
     _lMessageBacklog = new EventQueue<NetworkMessage>();
     _lPlayerRooms = new EventList<Hub>();
     Instance = this;
     Console.WriteLine("Setting up the server...");
     MessageReceived += ParseMessage;
 }
开发者ID:HeadhunterXamd,项目名称:BasicUDPServer,代码行数:13,代码来源:Server.cs

示例7: EventOptions

 /// <summary>
 /// Default constructor
 /// </summary>
 public EventOptions()
 {
     HostName = _hostName;
     OnErrorHttpCaptureFlags = HttpCaptureFlags.All;
     SourceLevels = SourceLevels.All;
     ConfigKeys = new Keys();
     ConnectorType = "HashTag.Logging.Client.NLog.NLogEventConnector, HashTag.Logging.Client";
     _queue = new EventQueue(this);
 }
开发者ID:HashTagDotNet,项目名称:EventLogger,代码行数:12,代码来源:EventOptions.cs

示例8: VerifyQueue

 private static void VerifyQueue(EventQueue q)
 {
     for (int index = 0; index < events.Length; index++)
     {
         Event e = q.Dequeue(false);
         Assert.AreEqual(events[index].GetType(), e.GetType(),
             string.Format("Event {0}", index));
     }
 }
开发者ID:Vernathic,项目名称:ic-AutoTest.NET4CTDD,代码行数:9,代码来源:EventQueueTests.cs

示例9: PumpAutoStopsOnRunFinished

 public void PumpAutoStopsOnRunFinished()
 {
     EventQueue q = new EventQueue();
     EventPump pump = new EventPump( NullListener.NULL, q, true );
     Assert.IsFalse( pump.Pumping, "Should not be pumping initially" );
     StartPump( pump, 1000 );
     Assert.IsTrue( pump.Pumping, "Pump failed to start" );
     q.Enqueue( new RunFinishedEvent( new Exception() ) );
     WaitForPumpToStop( pump, 1000 );
     Assert.IsFalse( pump.Pumping, "Pump failed to stop" );
 }
开发者ID:taoxiease,项目名称:asegrp,代码行数:11,代码来源:EventQueueTests.cs

示例10: SetUp

 public void SetUp()
 {
     theQueue = new EventQueue<FakeTopic>();
     theQueue.Write(new ServerEvent("2", "2"));
     theQueue.Write(new ServerEvent("1", "1"));
     
     for (int i = 3; i < 8; i++)
     {
         theQueue.Write(new ServerEvent(i.ToString(), i.ToString()));
     }    
 }
开发者ID:mtscout6,项目名称:FubuMVC.ServerSentEvents,代码行数:11,代码来源:SimpleEventQueueTester.cs

示例11: Attach

 public void Attach(EventBus bus)
 {
     var q = new EventQueue(EventQueueId.Data, EventQueueType.Master, EventQueuePriority.Normal, 25600, null)
     {
         IsSynched = true,
         Name = $"attached {bus.framework.Name}"
     };
     q.Enqueue(new OnQueueOpened(q));
     bus.DataPipe.Add(q);
     this.attached[this.attachedCount++] = q;
 }
开发者ID:fastquant,项目名称:fastquant.dll,代码行数:11,代码来源:EventBus.cs

示例12: PumpEvents

 public void PumpEvents()
 {
     EventQueue q = new EventQueue();
     EnqueueEvents( q );
     QueuingEventListener el = new QueuingEventListener();
     EventPump pump = new EventPump( el, q, false );
     Assert.IsFalse( pump.Pumping, "Should not be pumping initially" );
     StartPump( pump, 1000 );
     Assert.IsTrue( pump.Pumping, "Pump should still be running" );
     StopPump( pump, 1000 );
     Assert.IsFalse( pump.Pumping, "Pump should have stopped" );
     VerifyQueue( el.Events );
 }
开发者ID:taoxiease,项目名称:asegrp,代码行数:13,代码来源:EventQueueTests.cs

示例13: OnConnected

 protected override void OnConnected()
 {
     foreach (var s in Series)
     {
         var q = new EventQueue(EventQueueId.Data, EventQueueType.Master, EventQueuePriority.Normal, 25600, null)
         {
             IsSynched = true,
             Name = s.Name
         };
         q.Enqueue(new OnQueueOpened(q));
         this.framework.EventBus.DataPipe.Add(q);
         this.emitters.Add(new DataSeriesObject(s, DateTime1, DateTime2, q, Processor));
     }
 }
开发者ID:fastquant,项目名称:fastquant.dll,代码行数:14,代码来源:DataSimulator.cs

示例14: PumpEventsWithAutoStop

 public void PumpEventsWithAutoStop()
 {
     EventQueue q = new EventQueue();
     EnqueueEvents( q );
     QueuingEventListener el = new QueuingEventListener();
     EventPump pump = new EventPump( el, q, true );
     pump.Start();
     int tries = 10;
     while( --tries > 0 && q.Count > 0 )
     {
         Thread.Sleep(100);
     }
     VerifyQueue( el.Events );
     Assert.IsFalse( pump.Pumping, "Pump failed to stop" );
 }
开发者ID:taoxiease,项目名称:asegrp,代码行数:15,代码来源:EventQueueTests.cs

示例15: spin_up_pre_builds

        public void spin_up_pre_builds()
        {
            var factory = MockRepository.GenerateMock<IEventQueueFactory<FakeTopic>>();
            var queue = new EventQueue<FakeTopic>();
            var topic = new FakeTopic{
                Name = "Top"
            };

            factory.Stub(x => x.BuildFor(topic)).Return(queue);

            var family = new TopicFamily<FakeTopic>(factory);
            family.SpinUpChannel(topic);

            factory.AssertWasCalled(x => x.BuildFor(topic));
        }
开发者ID:mtscout6,项目名称:FubuMVC.ServerSentEvents,代码行数:15,代码来源:TopicFamilyTester.cs


注:本文中的EventQueue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。