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) =>
            //{

            //};
        }
 private void cbx_ApplyPriority_Click(object sender, EventArgs e)
 {
     if (cbx_ApplyPriority.Checked)
     {
         CompactDB.Write(App.ApplyUserPriority, "1");
     }
     else
     {
         CompactDB.Write(App.ApplyUserPriority, "0");
     }
 }
        protected override void prepareEvents()
        {
            base.prepareEvents();
            this.txb_NewProject.txb.KeyDown += (s, e) =>
            {
                if (e.KeyData == Keys.Enter)
                {
                    String strDirPath = String.Format("Projs\\{0}", txb_NewProject.Text.Trim());
                    Directory.CreateDirectory(strDirPath);
                    Thread.Sleep(500);
                    String [] arr = Directory.GetFiles(Path.Combine("Projs", cmbx_NewProjectBaseOnWhichProject.Text));
                    for (int i = 0; i < arr.Length; i++)
                    {
                        File.Copy(arr[i], Path.Combine(strDirPath, Path.GetFileName(arr[i])));
                    }

                    dotNetLab.Tipper.Info = "创建项目完成";
                    PrepareProjsUI();
                }
            };

            this.btn_DeleteProject.Click += (s, e) =>
            {
                if (cmbx_DeleteProject.Text == cmbx_CurrentProjectName.Text)
                {
                    dotNetLab.Tipper.Error = "不能删除当前正在运行的项目";
                    return;
                }
                else
                {
                    String[] arr = Directory.GetFiles(String.Format("Projs\\{0}", cmbx_DeleteProject.Text));
                    for (int i = 0; i < arr.Length; i++)
                    {
                        File.Delete(arr[i]);
                    }
                    Directory.Delete(String.Format("Projs\\{0}", cmbx_DeleteProject.Text));
                }
                PrepareProjsUI();
            };

            //to do 切换项目,务必重写此方法
            //! 注意务必使用ToolBlockEditV2.LoadShikii 来重新载入shikii
            cmbx_CurrentProjectName.SelectedIndexChanged += (s, e) =>
            {
                String strPath = String.Format("Projs\\{0}", cmbx_CurrentProjectName.Text);
                CompactDB.Write("Current_Project", strPath);
                // strPath =Path.Combine( Path.GetDirectoryName(Application.ExecutablePath),strPath);
                //使用作业管理器来切换项目
                App.job.Deserialize();
            };
        }
 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);
             }
         }
     }
 }