Ejemplo n.º 1
0
        public void Dispose()
        {
            if (this._pipelineDispatcher != null)
            {
                this._pipelineDispatcher.Dispose();
                this._pipelineDispatcher = null;
            }

            if (this._backgroundDispatcher != null)
            {
                this._backgroundDispatcher.Dispose();
                this._backgroundDispatcher = null;
            }

            if (this._gameThreadDispatcher != null)
            {
                this._gameThreadDispatcher.Dispose();
                this._gameThreadDispatcher = null;
            }
        }
        public void VerifyQueueActionWillQueueAndRunOnceRenderFrameFired()
        {
            var fakeDecalEventsProxy = new Fakes.FakeDecalEventsProxy();

            bool actionCalled = false;

            using (var dispatcher = new GameThreadDispatcher(fakeDecalEventsProxy))
            {
                dispatcher.QueueAction(() =>
                {
                    actionCalled = true;
                });

                Assert.AreEqual(1, dispatcher.QueueCount);

                // Fire the render event to simulate what decal would do
                fakeDecalEventsProxy.FireRenderFrame(new EventArgs());

                Assert.IsTrue(actionCalled);
                Assert.AreEqual(0, dispatcher.QueueCount);
            }
        }
Ejemplo n.º 3
0
 public DispatchManager(IDecalEventsProxy decalEventsProxy)
 {
     this._backgroundDispatcher = new BackgroundDispatcher();
     this._gameThreadDispatcher = new GameThreadDispatcher(decalEventsProxy);
     this._pipelineDispatcher = new PipelineDispatcher(decalEventsProxy);
 }