修改包名

This commit is contained in:
liufei
2022-03-25 16:23:14 +08:00
parent d61bf2af11
commit 9789e9b02b
3 changed files with 3 additions and 3 deletions

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Threading;
namespace GeekDesk.MyThread
{
public class DispatcherBuild
{
//创建一个Dispatcher来单独使用ui线程
public static Dispatcher Build()
{
Dispatcher dispatcher = null;
var manualResetEvent = new ManualResetEvent(false);
var thread = new System.Threading.Thread(() =>
{
dispatcher = Dispatcher.CurrentDispatcher;
var synchronizationContext = new DispatcherSynchronizationContext(dispatcher);
SynchronizationContext.SetSynchronizationContext(synchronizationContext);
manualResetEvent.Set();
Dispatcher.Run();
});
thread.Start();
manualResetEvent.WaitOne();
manualResetEvent.Dispose();
return dispatcher;
}
}
}