public ChannelFrame GetChannelFrame(string name) { ChannelFrame window = null; if (!this.windows.TryGetValue(name, out window)) { return(window); } return(window); }
public void CreateChannelFrame(string name, Action <ChannelFrame> callback) { Thread newWindowThread = new Thread(new ThreadStart(() => { SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher)); ChannelFrame window = new ChannelFrame(this); window.Closed += (s, e) => Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Background); windows.Add(name, window); callback(window); System.Windows.Threading.Dispatcher.Run(); })); newWindowThread.SetApartmentState(ApartmentState.STA); newWindowThread.Start(); }