Ejemplo n.º 1
0
        private static ReactViewRender CreateReactViewInstance()
        {
            var result = cachedView;

            cachedView = null;
            Application.Current.Dispatcher.BeginInvoke((Action)(() => {
                if (cachedView == null && !Application.Current.Dispatcher.HasShutdownStarted)
                {
                    cachedView = new ReactViewRender();
                    if (window == null)
                    {
                        window = new Window()
                        {
                            ShowActivated = false,
                            WindowStyle = WindowStyle.None,
                            ShowInTaskbar = false,
                            Visibility = Visibility.Hidden,
                            Width = 50,
                            Height = 50,
                            Top = int.MinValue,
                            Left = int.MinValue,
                            IsEnabled = false,
                            Title = "ReactViewRender Background Window"
                        };
                        window.Closed += (o, e) => {
                            cachedView?.Dispose();
                            cachedView = null;
                        };
                        window.Show();
                    }
                    window.Content = cachedView;
                }
            }), DispatcherPriority.Background);
            return(result ?? new ReactViewRender());
        }
Ejemplo n.º 2
0
 public void Dispose()
 {
     view.Dispose();
     GC.SuppressFinalize(this);
 }