private void CreateAndShowContent() { Dispatcher = Dispatcher.CurrentDispatcher; VisualTargetPresentationSource source = new VisualTargetPresentationSource(_hostVisual); _sync.Set(); source.RootVisual = _createContent(); DesiredSize = source.DesiredSize; _invalidateMeasure(); Dispatcher.Run(); source.Dispose(); }
private void MediaWorkerThread(object arg) { HostVisual hostVisual = (HostVisual)arg; var visualTargetPS = new VisualTargetPresentationSource(hostVisual); _threadReadyEvent.Set(); // Create a MediaElement and use it as the root visual for the // VisualTarget. visualTargetPS.RootVisual = CreateUIElement(); // Run a dispatcher for this worker thread. This is the central // processing loop for WPF. System.Windows.Threading.Dispatcher.Run(); }