Esempio n. 1
0
 protected abstract void InitializeComponents(TypeVisualizerDialog visualizerDialog, IServiceProvider provider);
Esempio n. 2
0
        public virtual void Show(IWin32Window owner, IServiceProvider provider)
        {
            if (visualizerDialog == null)
            {
                visualizerDialog       = CreateVisualizerDialog(provider);
                visualizerDialog.Load += delegate
                {
                    var bounds = Bounds;
                    if (!bounds.IsEmpty && (SystemInformation.VirtualScreen.Contains(bounds) || WindowState != FormWindowState.Normal))
                    {
                        if (bounds.Size.IsEmpty)
                        {
                            visualizerDialog.DesktopLocation = bounds.Location;
                        }
                        else
                        {
                            visualizerDialog.DesktopBounds = bounds;
                        }
                        visualizerDialog.WindowState = WindowState;
                    }
                };

                visualizerDialog.FormClosed += delegate
                {
                    var desktopBounds = Bounds;
                    if (visualizerDialog.WindowState != FormWindowState.Normal)
                    {
                        desktopBounds.Size = visualizerDialog.RestoreBounds.Size;
                    }
                    else
                    {
                        desktopBounds = visualizerDialog.DesktopBounds;
                    }

                    Bounds = desktopBounds;
                    if (visualizerDialog.WindowState == FormWindowState.Minimized)
                    {
                        WindowState = FormWindowState.Normal;
                    }
                    else
                    {
                        WindowState = visualizerDialog.WindowState;
                    }
                    visualizerDialog.Dispose();
                };

                visualizerDialog.HandleDestroyed += (sender, e) => visualizerDialog = null;
                InitializeComponents(visualizerDialog, provider);
                if (visualizerDialog.TopLevel)
                {
                    if (owner != null)
                    {
                        visualizerDialog.Show(owner);
                    }
                    else
                    {
                        visualizerDialog.Show();
                    }
                }
            }

            visualizerDialog.Activate();
        }