Exemplo n.º 1
0
        /// <summary>
        /// set DockContent
        /// </summary>
        private void SetDockContent(EcellDockContent content)
        {
            m_env.LogManager.Append(new ApplicationLogEntry(
                MessageType.Information,
                string.Format(MessageResources.DockPreparing, content.Text),
                this
            ));
            content.SuspendLayout();
            //Create New DockContent
            content.Pane = null;
            content.PanelPane = null;
            content.FloatPane = null;
            content.DockHandler.DockPanel = this.dockPanel;
            content.IsHidden = false;
            if (content.ContentType == DockContentType.GRAPH)
            {
                content.FormClosing += new FormClosingEventHandler(this.Graph_Closing);
            }
            else
            {
                content.FormClosing += new FormClosingEventHandler(this.DockContent_Closing);
            }

            //Create DockWindow Menu
            DockToolStripMenuItem item = new DockToolStripMenuItem(content);
            if (content.ContentType == DockContentType.NONE)
            {
                this.showWindowToolStripMenuItem.DropDown.Items.Add(item);
            }
            else if (content.ContentType == DockContentType.ANALYSIS)
            {
                this.analysisGroupToolStripMenuItem.DropDown.Items.Add(item);
            }
            else if (content.ContentType == DockContentType.GRAPH)
            {
                this.graphGroupToolStripMenuItem.DropDown.Items.Add(item);
            }

            m_dockWindowDic.Add(content.Name, content);
            content.ResumeLayout();
            content.Show(this.dockPanel, DockState.Document);
        }
Exemplo n.º 2
0
        public void TestConstructor()
        {
            EcellDockContent content = new EcellDockContent();
            Assert.IsNotNull(content, "Constructor of type, EcellDockContent failed to create instance.");
            Assert.AreEqual("Ecell.Plugin.EcellDockContent", content.GetType().ToString(), "Type is unexpected value.");
            Assert.AreEqual(true, content.HideOnClose, "HideOnClose is unexpected value.");
            Assert.AreEqual(DockContentType.NONE, content.ContentType, "ContentType is unexpected value.");

            content.HideOnClose = true;
            Assert.AreEqual(true, content.HideOnClose, "HideOnClose is unexpected value.");

            Form form = null;
            try
            {
                form = new Form();
                DockPanel panel = new DockPanel();
                panel.DocumentStyle = DocumentStyle.DockingWindow;
                form.SuspendLayout();
                form.Controls.Add(panel);
                form.SuspendLayout();
                form.Show();

                //Create New DockContent
                content.Pane = null;
                content.PanelPane = null;
                content.FloatPane = null;
                content.DockHandler.DockPanel = panel;
                content.IsHidden = false;
                content.Show();
                content.GetDesktopLocation();
                content.FloatAt(new Rectangle(100, 100, 500, 500));
                content.GetDesktopLocation();
                content.Hide();
                content.ContentType = DockContentType.NONE;
            }
            catch (Exception)
            {
                Assert.Fail("Fail to create new DockContent");
            }
            finally
            {
                if (form != null)
                    form.Close();
            }
        }