• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# EventQueue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: BaseInput

        public BaseInput(InputElement input, SelectorElement selector, EventQueue queue)
            : base()
        {
            InputName = input.Name;
            InputType = input.Type;
            SelectorName = selector.Name;
            Processor = selector.Processor;

            switch (selector.Login)
            {
                case "success": Login = LoginStatus.SUCCESS; break;
                case "failure": Login = LoginStatus.FAILURE; break;
                default: Login = LoginStatus.UNKNOWN; break;
            }

            equeue = queue;
        }
开发者ID:vokac,项目名称:F2B,代码行数:17,代码来源:Base.cs


示例17: RuntimeEngine

        public RuntimeEngine(RuntimeEntityService entityService, ISystemManager systemManager, EventQueue eventQueue, ILogger logger)
        {
            AddEntityAccessGate = new AccessGate();
            EventQueue = eventQueue;
            _logger = logger;
            EntityService = entityService;
            EntityService.AddEntityAccessGate = AddEntityAccessGate;
            SystemManager = systemManager;
            SystemUpdateScheduler = new SystemUpdateScheduler(SystemManager.Systems);

            foreach (var updateBurst in SystemUpdateScheduler.UpdateBursts)
            {
                _logger.Info($"Update Burst: {string.Join(", ", updateBurst.Systems.Select(p => p.System.Name))}");
            }

            // Add any entities that are already loaded into the engine.
            SystemManager.AddEntities(entityService.Entities);
        }
开发者ID:Simie,项目名称:OpenAOE,代码行数:18,代码来源:RuntimeEngine.cs


示例18: Start

        public void Start(int port, CryptoAlgoId_Values cryptoAlgoId, byte[] content, EventQueue eventQueue)
        {
            this.cryptoAlgoId = cryptoAlgoId;
            this.content = content;
            this.eventQueue = eventQueue;
            this.aes = PccrrUtitlity.CreateAes(cryptoAlgoId);
            this.iv = new byte[16];
            for (int i = 0; i < iv.Length; i++)
            {
                this.iv[i] = (byte)i;
            }

            pccrrServer = new PccrrServer(port);

            pccrrServer.MessageArrived += new MessageArrivedEventArgs(pccrrServer_MessageArrived);

            pccrrServer.StartListening();
        }
开发者ID:Microsoft,项目名称:WindowsProtocolTestSuites,代码行数:18,代码来源:PccrrTestServer.cs


示例19: Produce

        public void Produce(EventEntry item, string processor, EventQueue.Priority priority = EventQueue.Priority.Low)
        {
            if (equeue == null)
            {
                Log.Error("Unable to produce events before queue initialization!?!?");
                return;
            }

            if (string.IsNullOrEmpty(processor))
            {
                Log.Error("Unable to queue events with empty processor name");
                return;
            }

            Log.Info("Service[" + item.Id + "@" + item.Input.Name + "] (re)queued message"
                + " with first processor name " + processor);
            equeue.Produce(item, processor, priority);
        }
开发者ID:vokac,项目名称:F2B,代码行数:18,代码来源:Service.cs


示例20: Authenticate

        protected bool Authenticate(Session session, Identity identity, Request request)
        {
            var correlationId = new CorrelationID();
            var eventQueue = new EventQueue();
            session.SendAuthorizationRequest(request, identity, eventQueue, correlationId);
            while (true)
            {
                var eventArgs = eventQueue.NextEvent();

                foreach (var message in eventArgs.GetMessages())
                {
                    if (MessageTypeNames.AuthorizationFailure.Equals(message.MessageType))
                        return false;

                    if (MessageTypeNames.AuthorizationSuccess.Equals(message.MessageType))
                        return true;

                    throw new Exception("Unknown message type: " + message);
                }
            }
        }
开发者ID:rob-blackbourn,项目名称:JetBlack.Bloomberg,代码行数:21,代码来源:Authenticator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# EventRaisingClass类代码示例发布时间:2022-05-24
下一篇:
C# EventPublisher类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap