示例#1
0
 public void RunThread()
 {
     ThreadPool.QueueUserWorkItem((m) =>
     {
         threadRun = true;
         Thread.Sleep(500);
         while (checkBox2.Checked)
         {
             getStudyImage();
             SetTbcd();
             Thread.Sleep(300);
             SaveResult();
             Thread.Sleep(1000);
             studycount++;
             if (studycount > 1000)
             {
                 studycount = 0;
                 XmlUtils.WriteLibarayXml();
                 ConfigStore.SaveConfig();
                 Thread.Sleep(4000);
             }
         }
         threadRun = false;
     });
 }
示例#2
0
        private void button2_Click(object sender, EventArgs e)
        {
            // 导入
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = "c:\\";//注意这里写路径时要用c:\\而不是c:\
            openFileDialog.Filter           = "特征库文件(*.yar)|*.yar";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex      = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                String fName = openFileDialog.FileName;

                Libaray lib = new Libaray();
                lib.id = ConfigStore.libarays.Count < 10 ? "lib_0" + ConfigStore.libarays.Count : "lib_" + ConfigStore.libarays.Count;
                //lib.name = name;
                lib.status = 0;
                String undir = dir + "\\data\\" + lib.id + "\\";
                CommonUtil.CreateDir(undir);

                CommonUtil.unZipFile(fName, undir);

                String title   = fName.Substring(fName.LastIndexOf("\\") + 1);
                String xmlFile = undir + "data.xml";
                if (File.Exists(xmlFile))
                {
                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(xmlFile);
                    // root节点
                    XmlNode root = xmlDoc.SelectSingleNode("datas");
                    //获取到所有<datas>的子节点
                    XmlNodeList nodeList = root.ChildNodes;
                    XmlElement  xe       = null;
                    //遍历所有子节点
                    foreach (XmlNode xn in nodeList)
                    {
                        xe = (XmlElement)xn;
                        if (xe.Name.Equals("title"))
                        {
                            title = xe.InnerText;
                            break;
                        }
                    }
                }

                lib.name = title;
                ConfigStore.libarays.Add(lib);
                XmlUtils.loadLibarayXml(xmlFile, lib.id);

                LoadLibaray();
                ConfigStore.SaveConfig();
                MessageBox.Show("导入完成!");
            }
        }
示例#3
0
        public void CloseSystem()
        {
            Thread12306.Stop();

            XmlUtils.WriteLibarayXml();

            ConfigStore.isAutoBaojing      = Program.mainForm.isAutoBaojing();
            ConfigStore.isAutoWriterVerify = Program.mainForm.isAutoWriterVerify();
            ConfigStore.failedTimes        = Program.mainForm.getFailedTimes();
            ConfigStore.SaveConfig();
            _88448Class.Logout();
            Form1.firstExit = false;
            Form1.CloseApplication();
        }
示例#4
0
        private void SaveConfig()
        {
            ConfigStore.startType  = rb_yes.Checked ? "1" : "2";
            ConfigStore.updateType = rb_update1.Checked ? "1" : rb_update2.Checked ? "2" : "3";
            ConfigStore.algorithm  = radioButton1.Checked ? "1" : "2";

            ConfigStore.SetAllLibarayStatus(0);
            for (int i = 0; i < checkedListBox.Items.Count; i++)
            {
                if (checkedListBox.GetItemChecked(i))
                {
                    ConfigStore.SetLibarayStatus(i, 1);
                }
            }
            ConfigStore.SaveConfig();
            System.Threading.Thread.Sleep(200);
            this.Dispose();
        }
示例#5
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (textBox2.Visible)
            {
                String libId = GetLibId();
                foreach (Libaray lib in ConfigStore.libarays)
                {
                    if (lib.id.Equals(libId))
                    {
                        lib.name = textBox2.Text;
                        break;
                    }
                }

                VerifyEntity ve = null;
                foreach (String key in ConfigStore.codeTable.Keys)
                {
                    ve = (VerifyEntity)ConfigStore.codeTable[key];
                    if (ve.LibId.Equals(libId))
                    {
                        ve.LibName = textBox2.Text;
                    }
                }
                LoadLibaray();
                ConfigStore.SaveConfig();
                button3.Text     = "修改特征库名称";
                cb_lib.Enabled   = true;
                textBox2.Visible = false;
                button4.Visible  = false;
            }
            else
            {
                textBox2.Text    = cb_lib.Text;
                button3.Text     = "保存修改";
                cb_lib.Enabled   = false;
                textBox2.Visible = true;
                button4.Visible  = true;
            }
        }
示例#6
0
        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult dr;

            dr = MessageBox.Show(Program.mainForm, "您确定要删除此特征库吗?\n【" + cb_lib.Text + "】", "提醒", MessageBoxButtons.YesNoCancel,
                                 MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
            if (dr != DialogResult.Yes)
            {
                return;
            }
            String libId = GetLibId();

            foreach (Libaray lib in ConfigStore.libarays)
            {
                if (lib.id.Equals(libId))
                {
                    lib.status = 999;
                    break;
                }
            }

            VerifyEntity ve = null;

            foreach (String key in ConfigStore.codeTable.Keys)
            {
                ve = (VerifyEntity)ConfigStore.codeTable[key];
                if (ve.LibId.Equals(libId))
                {
                    ConfigStore.codeTable.Remove(key);
                }
            }

            LoadLibaray();
            ConfigStore.SaveConfig();
            MessageBox.Show("删除成功!");
        }