Exemplo n.º 1
0
        //关闭窗体 (不关闭OutPutWindow)
        //public void CloseAllDocumentBut(JForm exceptForm)
        //{
        //    if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
        //    {
        //        foreach (Form form in MdiChildren)
        //        {
        //            if (form != exceptForm && !(form is OutPutWindow))
        //                form.Close();
        //        }
        //    }
        //    else
        //    {
        //        foreach (IDockContent document in dockPanel.DocumentsToArray())
        //        {
        //            if (document != exceptForm && !(document is OutPutWindow))
        //            {
        //                document.DockHandler.Close();
        //            }
        //        }
        //    }
        //}
        //public void CloseAllDocumentButCurrent()
        //{
        //    if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
        //    {
        //        Form activeMdi = ActiveMdiChild;
        //        foreach (Form form in MdiChildren)
        //        {
        //            if (form != activeMdi && !(form is OutPutWindow))
        //                form.Close();
        //        }
        //    }
        //    else
        //    {
        //        foreach (IDockContent document in dockPanel.DocumentsToArray())
        //        {
        //            if (!document.DockHandler.IsActivated && !(document is OutPutWindow))
        //            {
        //                document.DockHandler.Close();
        //            }
        //        }
        //    }
        //}
        //public void CloseAllDocuments()
        //{
        //    if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
        //    {
        //        foreach (Form form in MdiChildren)
        //        {
        //            if (!(form is OutPutWindow))
        //            {
        //                form.Close();
        //            }
        //        }
        //    }
        //    else
        //    {
        //        for (int index = dockPanel.Contents.Count - 1; index >= 0; index--)
        //        {
        //            if (dockPanel.Contents[index] is IDockContent)
        //            {
        //                IDockContent content = (IDockContent)dockPanel.Contents[index];
        //                if (!(content is OutPutWindow))
        //                {
        //                    content.DockHandler.Close();
        //                }
        //            }
        //        }
        //    }
        //}
        //public void CloseCurrent()
        //{
        //    if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi && !(ActiveMdiChild is OutPutWindow))
        //    {
        //        ActiveMdiChild.Close();
        //    }
        //    else
        //    {
        //        foreach (IDockContent document in dockPanel.DocumentsToArray())
        //        {
        //            if (document.DockHandler.IsActivated && !(document is OutPutWindow))
        //            {
        //                document.DockHandler.Close();
        //            }
        //        }
        //    }
        //}
        //private void CloseAllContents()
        //{
        //    OutPutWin.DockPanel = null;
        //    CloseAllDocuments();
        //}


        #endregion

        #region File 菜单

        //New
        private void subItemOfNew_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem tsItem = sender as ToolStripMenuItem;

            Justin.Core.MenuItem data = tsItem.Tag as Justin.Core.MenuItem;
            ActiveContent(data);

            //TestDataGenerator tdgtool = new TestDataGenerator("");
            //tdgtool.MdiParent = this;
            //tdgtool.Show(dockPanel);
        }
Exemplo n.º 2
0
        //Open
        private void subItemOfOpen_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem tsItem = sender as ToolStripMenuItem;

            Justin.Core.MenuItem data = tsItem.Tag as Justin.Core.MenuItem;
            openFileDialog1.InitialDirectory = JSetting.ReadAppSetting("ConfigFileFolder");//注意这里写路径时要用c:\\而不是c:\
            openFileDialog1.Filter           = Tools.GetFileDialogFilter(data.Extensions);
            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.FilterIndex      = 1;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string fileName = openFileDialog1.FileName;
                ActiveContent(data, fileName);
            }
        }
Exemplo n.º 3
0
        private void ActiveContent(Justin.Core.MenuItem data, string fileName = "")
        {
            string classStr = data.Class;

            string[] classInfo = classStr.Trim().Split(',');
            if (classInfo.Length != 3)
            {
                this.ShowMessage("请检查Class设置");
                return;
            }
            JForm form = CreateJDockForm(classInfo[0], classInfo[2], string.IsNullOrEmpty(fileName) ? null : new object[] { new string[] { fileName } });

            if (form == null)
            {
                return;
            }
            if (form is IDB)
            {
                form.ShowStatus = true;
            }
            form.Show(dockPanel);
        }