예제 #1
0
        /// <remarks>
        ///		Note that this method should not be confused with Form.Close().
        ///		Be sure to deal with a compile-time instance of type IDesigner
        ///		to invoke this method.
        ///	</remarks>
        void IDesigner.Show()
        {
            UpdateTitle();
            Dataphoria.AttachForm(this);

            // HACK: Don't know why, but for some reason, setting the MDIParent of this form collapses the nodes tree.
            FNodesTree.ExpandAll();
        }
예제 #2
0
        protected void SetDesignHost(IHost host, bool owner)
        {
            if (host != _designHost)
            {
                SuspendLayout();
                try
                {
                    if (_designHost != null)
                    {
                        ActivateNode(null);
                        _palettePanel.SelectPaletteItem(null, false);

                        DetachDesignHost();
                        if (_isDesignHostOwner && !_designFormClosing)
                        {
                            ((IWindowsFormInterface)_designHost.Children[0]).Close(CloseBehavior.RejectOrClose);
                        }
                        _designHost = null;

                        FNodesTree.BeginUpdate();
                        try
                        {
                            ClearNodesTree();
                        }
                        finally
                        {
                            FNodesTree.EndUpdate();
                        }
                    }

                    _designHost        = host;
                    _isDesignHostOwner = owner;
                    try
                    {
                        if (_designHost != null)
                        {
                            FNodesTree.BeginUpdate();
                            try
                            {
                                if (_designHost.Children.Count != 0)
                                {
                                    FNodesTree.SelectedNode = FNodesTree.AddNode(_designHost.Children[0]);
                                    FNodesTree.SelectedNode.SetReadOnly(true, false);
                                    ActivateNode(FNodesTree.SelectedNode);
                                    // the tree doesn't initially raise an ActiveChanged event
                                }
                            }
                            finally
                            {
                                FNodesTree.EndUpdate();
                            }

                            AttachDesignHost(_designHost);
                        }
                    }
                    catch
                    {
                        _designHost = null;
                        ClearNodesTree();
                        throw;
                    }
                }
                finally
                {
                    ResumeLayout(true);
                }
            }
        }