private static void LoadBuffBarWindow() { var buffBarThread = new Thread(new ThreadStart(() => { SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher)); BuffWindow = new BuffWindow(); BuffBarWindowViewModel.Instance.Player = new Data.Player(); BuffWindow.Show(); waiting = false; Dispatcher.Run(); })); buffBarThread.Name = "Buff bar thread"; buffBarThread.SetApartmentState(ApartmentState.STA); buffBarThread.Start(); Debug.WriteLine("Buff window loaded"); }
private static void LoadBuffBarWindow() { var buffBarThread = new Thread(() => { SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher)); BuffWindow = new BuffWindow(); if (BuffWindow.WindowSettings.Enabled) { BuffWindow.Show(); } AddDispatcher(Thread.CurrentThread.ManagedThreadId, Dispatcher.CurrentDispatcher); Dispatcher.Run(); RemoveDispatcher(Thread.CurrentThread.ManagedThreadId); }) { Name = "Buff" }; buffBarThread.SetApartmentState(ApartmentState.STA); buffBarThread.Start(); }