示例#1
0
        //检查是否打开
        bool FindEditForm(string file, bool isOpen)
        {
            DockContentCollection contents = dockPanel.Contents;

            //遍历所有标签
            foreach (DockContent dc in contents.Cast <DockContent>())
            {
                IEditForm edform = (IEditForm)dc;
                if (edform == null)
                {
                    continue;
                }

                if (isOpen)//是否检查打开
                {
                    if (file != null && file.Equals(edform.GetOpenFile()))
                    {
                        edform.SetActived();
                        return(true);
                    }
                }
                else//检查是否空白,如果为空,则打开文件
                {
                    if (string.IsNullOrEmpty(edform.GetOpenFile()) && edform.CanOpen(file))
                    {
                        _ = edform.Open(file, Path.GetFileNameWithoutExtension(openfile));
                        edform.SetActived();
                        return(true);
                    }
                }
            }
            return(false);
        }
示例#2
0
        void InitForm()
        {
            LanguageHelper.SetFormLabel(this);

            //设置所有窗口的语言
            DockContentCollection contents = dockPanel.Contents;

            foreach (DockContent dc in contents.Cast <DockContent>())
            {
                if (dc is not null)
                {
                    LanguageHelper.SetFormLabel(dc);
                }
            }
            //添加历史菜单
            history.MenuHistory();

            //如果没有将要打开的文件,则打开一个空数据库标签
            if (string.IsNullOrEmpty(openfile))
            {
                OpenDataBase(null);
            }
            else
            {
                Open(openfile);
            }
        }