本文整理汇总了C#中Dispatcher.Join方法的典型用法代码示例。如果您正苦于以下问题:C# Dispatcher.Join方法的具体用法?C# Dispatcher.Join怎么用?C# Dispatcher.Join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dispatcher
的用法示例。
在下文中一共展示了Dispatcher.Join方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
private void Start(object sender, EventArgs eventArgs)
{
Task.Factory.StartNew(Dequeue);
timer = new System.Timers.Timer(1000);
timer.Elapsed += timer_Elapsed;
timer.Start();
var service = "7500";
var network = ";239.255.0.1";
var daemon = "tcp:7500";
var subject = "TEST.Perf";
receivedMessages = 0;
log.InfoFormat("Connecting to TIBCO. Daemon: {0} service: {1}, network: {2}, subject {3}", daemon, service, network, subject);
try
{
Environment.Open();
this.transport = new NetTransport(service, network, daemon);
this.listener = new Listener(Queue.Default, OnMessageReceived, transport, subject, null);
this.dispacher = new Dispatcher(listener.Queue);
log.Info("Connected to TIBCO successfully");
log.Info("Waiting for messages");
dispacher.Join();
}
catch (Exception exception)
{
log.Error("Error connecting to TIBCO", exception);
this.Stop(this, EventArgs.Empty);
}
}
示例2: QueueDispatch
/// <summary>
/// 派送Tibco Queue的執行緒
/// </summary>
/// <param name="status"></param>
private void QueueDispatch(object status)
{
tbDispatcher = new Dispatcher(tbQueue);
tbDispatcher.Join();
}