Пример #1
0
        /// <summary>
        /// Create the default gui.
        /// </summary>
        void CadKit.Interfaces.IGuiDelegate.create(object caller)
        {
            lock (this.Mutex)
            {
                if (null == this.Document)
                {
                    return;
                }

                _view          = new CadKit.Viewer.Viewer();
                _view.Icon     = System.Windows.Forms.Application.OpenForms[0].Icon;
                _view.Text     = this.Document.Name;
                _view.KeyDown += new System.Windows.Forms.KeyEventHandler(_view_KeyDown);

                // Attach viewer and document to each other.
                _view.Document = this.Document;
                _view.Document.add(_view);

                CadKit.Interfaces.IUpdateScene update = this.Document as CadKit.Interfaces.IUpdateScene;

                if (null != update)
                {
                    _view.Panel.BeginPaintEvent += update.updateScene;
                }
                //view.FormClosed += this._viewClosed;

                CadKit.Interfaces.IBuildScene buildScene = this.Document as CadKit.Interfaces.IBuildScene;
                if (null != buildScene)
                {
                    _view.Scene = buildScene.Scene;
                }

                CadKit.Interfaces.IDockPanel   getPanel = caller as CadKit.Interfaces.IDockPanel;
                WeifenLuo.WinFormsUI.DockPanel panel    = (null != getPanel) ? (getPanel.DockPanel as WeifenLuo.WinFormsUI.DockPanel) : null;

                if (null != panel)
                {
                    if (panel.DocumentStyle == WeifenLuo.WinFormsUI.DocumentStyles.SystemMdi)
                    {
                        _view.MdiParent = caller as System.Windows.Forms.Form;
                        CadKit.Tools.Size.mdiChild(panel.DocumentRectangle.Size, _view);
                        _view.Show();
                    }
                    else
                    {
                        _view.Show(panel);
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Create the default gui.
        /// </summary>
        void CadKit.Interfaces.IGuiDelegate.create(object caller)
        {
            lock (this.Mutex)
            {
                if (null == this.Document)
                {
                    return;
                }

                // Make new viewer.
                CadKit.Viewer.Viewer view = new CadKit.Viewer.Viewer();
                view.Icon = System.Windows.Forms.Application.OpenForms[0].Icon;
                view.Text = this.Document.Name;

                // Attach viewer and document to each other.
                view.Document = this.Document;
                view.Document.add(view);

                // Build the scene.
                CadKit.Interfaces.IBuildScene buildScene = this.Document as CadKit.Interfaces.IBuildScene;
                if (null != buildScene)
                {
                    view.Scene = buildScene.Scene;
                }

                // Get dock-panel and show.
                CadKit.Interfaces.IDockPanel   getPanel = caller as CadKit.Interfaces.IDockPanel;
                WeifenLuo.WinFormsUI.DockPanel panel    = (null != getPanel) ? (getPanel.DockPanel as WeifenLuo.WinFormsUI.DockPanel) : null;
                if (null != panel)
                {
                    if (panel.DocumentStyle == WeifenLuo.WinFormsUI.DocumentStyles.SystemMdi)
                    {
                        view.MdiParent = caller as System.Windows.Forms.Form;
                        CadKit.Tools.Size.mdiChild(panel.DocumentRectangle.Size, view);
                        view.Show();
                    }
                    else
                    {
                        view.Show(panel);
                    }
                }
            }
        }