void PrepareProjsUI()
        {
            String ApplyUserPriority = CompactDB.FetchValue(App.ApplyUserPriority);

            if (int.Parse(ApplyUserPriority) > 0)
            {
                cbx_ApplyPriority.Checked = true;
            }
            else
            {
                cbx_ApplyPriority.Checked = false;
            }
            cmbx_CurrentProjectName.Items.Clear();
            cmbx_DeleteProject.Items.Clear();
            cmbx_NewProjectBaseOnWhichProject.Items.Clear();
            String[] strArr = null;
            if (!Directory.Exists("Projs"))
            {
                Directory.CreateDirectory("Projs");
            }

            strArr = Directory.GetDirectories("Projs");

            for (int i = 0; i < strArr.Length; i++)
            {
                strArr[i] = Path.GetFileNameWithoutExtension(strArr[i]);
            }
            this.cmbx_CurrentProjectName.Items.AddRange(strArr);
            cmbx_CurrentProjectName.Text = Path.GetFileNameWithoutExtension(CompactDB.FetchValue("Current_Project"));
            cmbx_DeleteProject.Items.AddRange(strArr);
            cmbx_NewProjectBaseOnWhichProject.Items.AddRange(strArr);
            cmbx_NewProjectBaseOnWhichProject.Text = cmbx_CurrentProjectName.Text;
        }
        protected override void prepareCtrls()
        {
            base.prepareCtrls();
            InitializeComponent();
            CheckProjectFolder();
            DspWndLayoutManager = new dotNetLab.Vision.DspWndLayout();
            cc :;
            String str = CompactDB.FetchValue("AppName");

            if (str == null)
            {
                CompactDB.Write("AppName", "视觉检测应用");
                goto cc;
            }
            this.Text = str;
            if (-99999 == CompactDB.FetchIntValue("DisplayWndNum"))
            {
                CompactDB.Write("DisplayWndNum", "1");
            }
            DspWndLayoutManager.PrepareDspWnds(typeof(MVDisplay), this.canvasPanel1, CompactDB.FetchIntValue("DisplayWndNum"));

            this.Load += (sender, e) =>
            {
                //必须使用这个方法来最大化窗体
                this.MaxWindow();
            };
            // PrepareVision();
        }
        protected override void prepareData()
        {
            base.prepareData();
            String str = CompactDB.FetchValue(App.AutoCleanTime);

            if (str == null)
            {
                CompactDB.Write(App.AutoCleanTime, "0");
            }
            String ApplyUserPriority = CompactDB.FetchValue(App.ApplyUserPriority);

            if (ApplyUserPriority == null)
            {
                CompactDB.Write(App.ApplyUserPriority, "0");
            }
            String HideMainForm = CompactDB.FetchValue(App.HideMainForm);

            if (HideMainForm == null)
            {
                CompactDB.Write(App.HideMainForm, "0");
            }

            //to do 添加通讯支持
            //factoryServer = new TCPFactoryServer();

            //factoryServer.Boot();

            //factoryServer.Route = (nWhichClient, byts) =>
            //{

            //};
        }
        public Form  ShowQuickBuildForm()
        {
            String HideMainForm = CompactDB.FetchValue(App.HideMainForm);

            if (HideMainForm == "1")
            {
                //PatternForm frm = new PatternForm();
                //frm.Owner = this;
                //frm.Text = "作业管理器";
                //JobToolEditV2 editV2 = new JobToolEditV2();
                //editV2.Subject = App.job;
                //editV2.Dock = DockStyle.Fill;
                //frm.Size = new System.Drawing.Size(editV2.Width + 20, editV2.Height + 20);

                //frm.Controls.Add(editV2);

                Form frm = AppManager.ShowFixedPage(typeof(MenuForm));


                frm.FormClosed += (sender, e) =>
                {
                    this.Close();
                };
                return(frm);
            }

            else if (HideMainForm == "2")
            {
                return(ShowJobWindow());
            }
            else
            {
                return(this);
            }
        }
 void CheckProjectFolder()
 {
     if (!Directory.Exists(App.ProjsFolderName))
     {
         Directory.CreateDirectory(App.ProjsFolderName);
         if (!Directory.Exists(App.OriginProjectPath))
         {
             Directory.CreateDirectory(App.OriginProjectPath);
             String str = CompactDB.FetchValue(App.CurrentProject);
             if (String.IsNullOrEmpty(str) || str.Equals("0"))
             {
                 CompactDB.Write(App.CurrentProject, App.OriginProjectPath);
             }
         }
     }
 }
        private void btn_More_Click(object sender, EventArgs e)
        {
            int n = 0;

            try
            {
                String ApplyUserPriority = CompactDB.FetchValue(App.ApplyUserPriority);
                n = int.Parse(ApplyUserPriority);
            }
            catch
            {
                Tipper.Error = "检测到你可能启用了权限管理,但是可能配置不正确!";
            }
            if (n > 0)
            {
                LogInForm logIn = new LogInForm();
                logIn.ShowDialog();
                if (!logIn.bCloseWindow)
                {
                    return;
                }
            }

            foreach (Form item in Application.OpenForms)
            {
                if (item is MenuForm)
                {
                    if (item.Owner != this)
                    {
                        return;
                    }
                    if (item.WindowState == FormWindowState.Minimized)
                    {
                        item.WindowState = FormWindowState.Normal;
                    }
                    item.BringToFront();
                    return;
                }
            }
            Form frm = AppManager.ShowFixedPage(typeof(MenuForm));

            frm.Owner = this;
        }