示例#1
0
        static void OnCreateContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            BackgroundVisualHost bvh = (BackgroundVisualHost)d;

            if (bvh.IsContentShowing)
            {
                bvh.HideContentHelper();
                if (e.NewValue != null)
                {
                    bvh.CreateContentHelper();
                }
            }
        }
示例#2
0
            public ThreadedVisualHelper(
                CreateContentFunction createContent,
                Action invalidateMeasure,
                BackgroundVisualHost parent)
            {
                _parent            = parent;
                _hostVisual        = new HostVisual();
                _createContent     = createContent;
                _invalidateMeasure = invalidateMeasure;

                Thread backgroundUi = new Thread(CreateAndShowContent);

                backgroundUi.SetApartmentState(ApartmentState.STA);
                backgroundUi.Name         = "BackgroundVisualHostThread";
                backgroundUi.IsBackground = true;
                backgroundUi.Start();
                updatePropsCTS = new CancellationTokenSource();
                _sync.WaitOne();
            }