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

C# Dispatcher类代码示例

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

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



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

示例1: Attach

 public static void Attach()
 {
     AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
     dispatcher = Dispatcher.CurrentDispatcher;
     dispatcher.UnhandledException += CurrentDispatcher_UnhandledException;
     TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
 }
开发者ID:nagyist,项目名称:PlatformInstaller,代码行数:7,代码来源:ExceptionHandler.cs


示例2: Given

 public void Given()
 {
     _operation = new FailOnceOperation();
     _invoker = new OperationInvoker<string>(_operation);
     _invoker.Policies.Add(new Retry(null));
     _engine = new Dispatcher<string>();
 }
开发者ID:rajeshgupthar,项目名称:objectflow,代码行数:7,代码来源:WhenExecutingInvokerWithPolicy.cs


示例3: LightClawSynchronizationContext

        public LightClawSynchronizationContext(Dispatcher dispatcher, DispatcherPriority priority)
        {
            Contract.Requires<ArgumentNullException>(dispatcher != null);

            this.dispatcher = dispatcher;
            this.priority = priority;
        }
开发者ID:ScianGames,项目名称:Engine,代码行数:7,代码来源:LightClawSynchronizationContext.cs


示例4: FinalizeWorkDispatcher

 private static void FinalizeWorkDispatcher(Dispatcher dispatcher)
 {
     if (dispatcher != null)
     {
         dispatcher.Dispose();
     }
 }
开发者ID:ReactiveServices,项目名称:ReactiveServices.Application,代码行数:7,代码来源:StepsExecutor.cs


示例5: Dispatcher

 public Dispatcher()
 {
     Debug.Assert(_instance == null);
     _instance = this;
     _thread = new Thread(run);
     _thread.Start();
 }
开发者ID:externl,项目名称:ice,代码行数:7,代码来源:Dispatcher.cs


示例6: ViewModel

        /// <summary>
        /// Constructor.
        /// </summary>
        public ViewModel(Dispatcher uiDispatcher, string baseContentDir, Isometry iso)
        {
            //  Reference to the UIDispatcher for thread-safe collection manipulation
            _uiDispatcher = uiDispatcher;

            Factions = new ObservableCollection<FactionList> { new FactionList("AI"), new FactionList("Player 1"), new FactionList("Player 2") };
            
            //  Map setup
            Map = new MapDefinition(new ZTile(baseContentDir + "tiles\\Generic Tiles\\Generic Floors\\DirtSand\\Waste_Floor_Gravel_SandDirtCentre_F_1_NE.til"), iso, baseContentDir);
            MapCanvas = new MapCanvas(Map, uiDispatcher, baseContentDir + "tiles\\", iso, Factions);
            _useAltEditLayer = false;


            //  Create the available TileSets and collection views
            TileSets = new Dictionary<string, ObservableCollection<ZTile>>();
            TileSetViews = new Dictionary<string, ListCollectionView>();
            foreach (var di in new DirectoryInfo(baseContentDir + "tiles\\").GetDirectories())
            {
                TileSets.Add(di.Name, new ObservableCollection<ZTile>());
                TileSetViews.Add(di.Name, new ListCollectionView(TileSets[di.Name]));
            }

            //  Start a new thread to load in the tile images
            ThreadPool.QueueUserWorkItem(GetWholeTileSet, baseContentDir + "tiles\\");
        }
开发者ID:jo215,项目名称:Iso,代码行数:28,代码来源:ViewModel.cs


示例7: ConnectInternal

        private static async Task<IClient> ConnectInternal(ConnectionParams connectionParams, CancellationToken cancellationToken, Dispatcher dispatcher, CancellationTokenSource apiCancellationTokenSource)
        {
            try
            {
                var stream = await SetupConnection(connectionParams.HostName, connectionParams.Port);
                var fieldsStream = new FieldsStream(stream);
                var serializer = new IBSerializer();
                await Handshake(connectionParams.ClientId, fieldsStream, serializer, cancellationToken);

                var connection = new Connection.Connection(fieldsStream, serializer);
                var factory = new ApiObjectsFactory(connection, new IdsDispenser(connection), dispatcher, apiCancellationTokenSource);
                var waitForMarketConnected = factory.CreateWaitForMarketConnectedOperation(cancellationToken);
                var waitForAccountsList = factory.CreateReceiveManagedAccountsListOperation(cancellationToken);

                connection.ReadMessagesAndDispatch();

                await waitForMarketConnected;
                var accountStorage = await factory.CreateAccountStorageOperation(await waitForAccountsList, cancellationToken);
                return factory.CreateClient(accountStorage);
            }
            catch
            {
                apiCancellationTokenSource.Cancel();
                throw;
            }
        }
开发者ID:qadmium,项目名称:ibapi,代码行数:26,代码来源:ConnectionFactory.cs


示例8: ShouldExecuteFunction

        public void ShouldExecuteFunction()
        {
            var engine = new Dispatcher<string>();
            engine.Execute(new OperationDuplex<string>(_function.Object), "Red");

            _function.Verify((f)=>f.Execute("Red"), Times.Exactly(3));
        }
开发者ID:nelsestu,项目名称:objectflow,代码行数:7,代码来源:WhenRetryingFunctions.cs


示例9: DispatcherContext

 /// <summary>
 /// Initialies a new <see cref="DispatcherContext"/> synchronized with a new <see cref="Thread"/> instance
 /// </summary>
 /// <param name="threadApartmentState">The <see cref="ApartmentState"/> of the <see cref="Dispatcher"/>'s <see cref="Thread"/></param>
 ///<param name="owner">The <see cref="Dispatcher"/> that owns the <see cref="DispatcherContext"/></param>
 public DispatcherContext(Dispatcher owner, ApartmentState threadApartmentState)
 {
     Thread dispatcherThread;
     this.Owner = owner;
     dispatcherThread = new Thread(new ParameterizedThreadStart(this.ExecuteOperations));
     dispatcherThread.SetApartmentState(threadApartmentState);
 }
开发者ID:yonglehou,项目名称:Photon,代码行数:12,代码来源:DispatcherContext.cs


示例10: SoftRigidDynamicsWorld

		public SoftRigidDynamicsWorld(Dispatcher dispatcher, BroadphaseInterface pairCache,
			ConstraintSolver constraintSolver, CollisionConfiguration collisionConfiguration,
			SoftBodySolver softBodySolver)
            : base(IntPtr.Zero)
		{
            if (softBodySolver != null) {
                _softBodySolver = softBodySolver;
                _ownsSolver = false;
            } else {
                _softBodySolver = new DefaultSoftBodySolver();
                _ownsSolver = true;
            }

            _native = btSoftRigidDynamicsWorld_new2(dispatcher._native, pairCache._native,
                (constraintSolver != null) ? constraintSolver._native : IntPtr.Zero,
                collisionConfiguration._native, _softBodySolver._native);

            _collisionObjectArray = new AlignedCollisionObjectArray(btCollisionWorld_getCollisionObjectArray(_native), this);

            _broadphase = pairCache;
			_constraintSolver = constraintSolver;
			_dispatcher = dispatcher;
            _worldInfo = new SoftBodyWorldInfo(btSoftRigidDynamicsWorld_getWorldInfo(_native), true);
            _worldInfo.Dispatcher = dispatcher;
            _worldInfo.Broadphase = pairCache;
		}
开发者ID:rhynodegreat,项目名称:BulletSharpPInvoke,代码行数:26,代码来源:SoftRigidDynamicsWorld.cs


示例11: CharacterEditor

 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="viewModel"></param>
 public CharacterEditor(ViewModel viewModel, Dispatcher uiDispatcher, List<Unit> newRoster = null)
 {
     _uiDispatcher = uiDispatcher;
     DataContext = this;
     Test = "dhsfuifbvosfbo";
     WindowStyle = WindowStyle.ToolWindow;
     ViewModel = viewModel;
     //  Faction unit lists
     Factions = ViewModel.Factions;
     if (newRoster == null)
     {
         Factions[1].Units.Add(new Unit(1, BodyType.Enclave, WeaponType.SMG, Stance.Stand, 10, 10, 10, 10, 10, -1, -1, "James"));
         Factions[2].Units.Add(new Unit(2, BodyType.TribalFemale, WeaponType.Club, Stance.Stand, 10, 10, 10, 10, 10, -1, -1, "John"));
     }
     else
     {
         foreach (Unit u in newRoster)
         {
             Factions[u.OwnerID].Units.Add(u);
         }
     }
     InitializeComponent();
     body.ItemsSource = Enum.GetValues(typeof (BodyType));
     weapon.ItemsSource = Enum.GetValues(typeof (WeaponType));
     
 }
开发者ID:jo215,项目名称:Iso,代码行数:30,代码来源:CharacterEditor.xaml.cs


示例12: AndItShouldNotDoThat

        public void AndItShouldNotDoThat()
        {
            var handlerActivator = new HandlerActivatorForTesting();
            var pipelineInspector = new TrivialPipelineInspector();
            var handleDeferredMessage = new MockDeferredMessageHandler();
            var dispatcher = new Dispatcher(new InMemorySagaPersister(),
                                        handlerActivator,
                                        new InMemorySubscriptionStorage(),
                                        pipelineInspector,
                                        handleDeferredMessage,
                                        null);

            dispatcher.Dispatch(new TimeoutReply
            {
                CorrelationId = TimeoutReplyHandler.TimeoutReplySecretCorrelationId,
                CustomData = TimeoutReplyHandler.Serialize(new Message { Id = "1" })
            });

            dispatcher.Dispatch(new TimeoutReply
            {
                CustomData = TimeoutReplyHandler.Serialize(new Message { Id = "2" })
            });

            handleDeferredMessage.DispatchedMessages.Count.ShouldBe(1);
            var dispatchedMessage = handleDeferredMessage.DispatchedMessages[0];
            dispatchedMessage.ShouldBeOfType<Message>();
            ((Message)dispatchedMessage).Id.ShouldBe("1");
        }
开发者ID:nls75,项目名称:Rebus,代码行数:28,代码来源:DeferStealsOurTimeoutReplies.cs


示例13: AndItShouldNotDoThat

        public void AndItShouldNotDoThat()
        {
            var handlerActivator = new HandlerActivatorForTesting();
            var pipelineInspector = new TrivialPipelineInspector();
            var handleDeferredMessage = Mock<IHandleDeferredMessage>();
            var dispatcher = new Dispatcher(new InMemorySagaPersister(),
                                        handlerActivator,
                                        new InMemorySubscriptionStorage(),
                                        pipelineInspector,
                                        handleDeferredMessage);

            dispatcher.Dispatch(new TimeoutReply
            {
                CorrelationId = TimeoutReplyHandler.TimeoutReplySecretCorrelationId,
                CustomData = TimeoutReplyHandler.Serialize(new Message { Id = "1" })
            });

            dispatcher.Dispatch(new TimeoutReply
            {
                CustomData = TimeoutReplyHandler.Serialize(new Message { Id = "2" })
            });

            handleDeferredMessage.AssertWasCalled(x => x.Dispatch(Arg<Message>.Is.Anything), x => x.Repeat.Once());
            handleDeferredMessage.AssertWasCalled(x => x.Dispatch(Arg<Message>.Matches(y => y.Id == "1")));
        }
开发者ID:asgerhallas,项目名称:Rebus,代码行数:25,代码来源:DeferStealsOurTimeoutReplies.cs


示例14: initTTAPI

        /// <summary>
        /// Init and start TT API.
        /// </summary>
        /// <param name="instance">XTraderModeTTAPI instance</param>
        /// <param name="ex">Any exception generated from the XTraderModeDelegate</param>
        public void initTTAPI(XTraderModeTTAPI apiInstance, Exception ex)
        {
            m_dispatcher = Dispatcher.Current;
            m_session = apiInstance.Session;

            m_TTAPI = apiInstance;
            m_TTAPI.ConnectionStatusUpdate += ttapiInstance_ConnectionStatusUpdate;
            m_TTAPI.ConnectToXTrader();
        }
开发者ID:itsff,项目名称:CodeSamples_TTAPI_CSharp,代码行数:14,代码来源:AutospreaderManager.cs


示例15: Main

 private static void Main()
 {
     Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
     var database = new IssueTrackerDatabase();
     var issueTracker = new IssueTracker(database);
     var dispatcher = new Dispatcher(issueTracker);
     var engine = new Engine(dispatcher);
     engine.Run();
 }
开发者ID:EBojilova,项目名称:CSharpHQC,代码行数:9,代码来源:Program.cs


示例16: IncomingMessageAgent

 internal IncomingMessageAgent(Message.Categories cat, IMessageCenter mc, ActivationDirectory ad, OrleansTaskScheduler sched, Dispatcher dispatcher) :
     base(cat.ToString())
 {
     category = cat;
     messageCenter = mc;
     directory = ad;
     scheduler = sched;
     this.dispatcher = dispatcher;
     OnFault = FaultBehavior.RestartOnFault;
 }
开发者ID:PaulNorth,项目名称:orleans,代码行数:10,代码来源:IncomingMessageAgent.cs


示例17: SpreadDetailsForm

        /// <summary>
        /// Constructor for a new SpreadDetailsForm.
        /// </summary>
        /// <param name="session">Session</param>
        /// <param name="dispatcher">Dispatcher</param>
        public SpreadDetailsForm(Session session, Dispatcher dispatcher)
        {
            InitializeComponent();

            m_isNewSpread = true;
            m_session = session;
            m_dispatcher = dispatcher;
            m_spreadDetails = new SpreadDetails();
            initFields();
        }
开发者ID:adajinjin,项目名称:CodeSamples_TTAPI_CSharp,代码行数:15,代码来源:SpreadDetailsForm.cs


示例18: OrdersProxy

        public OrdersProxy(IOrder order, Dispatcher dispatcher)
        {
            System.Diagnostics.Contracts.Contract.Requires(order != null);
            System.Diagnostics.Contracts.Contract.Requires(dispatcher != null);

            this.order = order;
            this.dispatcher = dispatcher;

            this.order.OrderChanged += this.OnOrderChanged;
            this.orderChangedEvent = this.dispatcher.RegisterEvent();
        }
开发者ID:qadmium,项目名称:ibapi,代码行数:11,代码来源:OrdersProxy.cs


示例19: Client

        public Client(GlowListener host, Socket socket, int maxPackageLength, Dispatcher dispatcher)
        {
            Host = host;
             Socket = socket;
             MaxPackageLength = maxPackageLength;
             Dispatcher = dispatcher;

             _reader = new GlowReader(GlowReader_RootReady, GlowReader_KeepAliveRequestReceived);
             _reader.Error += GlowReader_Error;
             _reader.FramingError += GlowReader_FramingError;
        }
开发者ID:jv42,项目名称:ember-plus,代码行数:11,代码来源:Client.cs


示例20: GetInstance

	private ObjectInteraction scribeNurse = null; // send record commands to her.

    public static Dispatcher GetInstance()
    {
		if (instance == null){
			instance = FindObjectOfType(typeof(Dispatcher)) as Dispatcher;
			if (instance == null){ // no dispatcher in the level, add one
				GameObject dgo = new GameObject("Dispatcher");
				instance = dgo.AddComponent<Dispatcher>();
			}
		}
  	    return instance;
    }
开发者ID:MedStarSiTEL,项目名称:UnityTrauma,代码行数:13,代码来源:Dispatcher.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# DispatcherPriority类代码示例发布时间:2022-05-24
下一篇:
C# Dispatch2类代码示例发布时间: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