Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            rw_dog dog = new rw_dog();

                if (checkBox1.Checked == false)
                {
                    string id = dog.jRead(220, 4);
                    string data = dog.jRead(111, 8);
                    string a_c = dog.jRead(224, 1);
                    textBox1.Text = id;
                    textBox2.Text = data;
                    if (a_c == "A")
                        radioButton1.Checked = true;
                    else if (a_c == "C")
                        radioButton2.Checked = true;
                    else { }
                }
                else
                {
                    textBox5.Text = dog.jRead(int.Parse(textBox3.Text.Trim()), int.Parse(textBox4.Text.Trim()));
                }
                if (!Function.torf(textBox1.Text) || !Function.torf(textBox2.Text) || !Function.torf(textBox5.Text))
                {
                    showfalse();
                    if (!Function.torf(textBox1.Text)) label10.Text += "\n员工号读取失败";
                    if (!Function.torf(textBox2.Text)) label10.Text +="\n日期读取失败";
                }
                else
                    showtrue();
        }
Beispiel #2
0
        private void Camera_start_Load(object sender, EventArgs e)
        {
            //if (rw_dog.findPort().ToString() == "-92")
            //{
            //    MessageBox.Show("未插入加密狗,请插入后重试!");
            //    this.Close();
            //    this.Dispose();
            //    Application.Exit();//只是程序退出的话后面还会继续执行
            //    return;
            //}
            List<string> list = Clscamera.GetDevices();
            if (list.Count > 0)
            {
                foreach (var x in list)
                {
                    cobCam.Items.Add(x);
                }
                cobCam.SelectedIndex = list.Count - 1;

            }
            else
            {
                MessageBox.Show("未检测到设备,请连接设备后再试");
                Application.Exit();
                return;
            }

            //读取加密狗

            rw_dog dog = new rw_dog();
            labID.Text = dog.jRead(220, 4);
            //labID.Text = "0031";
            ConfigInfo.UserID = labID.Text;
            dictXm = Function.getlistXM();//获取项目列表时进行员工名的判断并赋值给全局变量
            labName.Text =ConfigInfo.UserName;

            string dftXm = "";
            using (StreamReader sr = new StreamReader(Application.StartupPath+"\\Info\\config.ini", Encoding.UTF8))
            {
                string aline = "";

                while ((aline = sr.ReadLine()) != null)
                    if (aline.StartsWith("XM:"))
                    {
                        dftXm = aline.Substring(3);
                        break;
                    }
            }

            foreach (var x in dictXm)
            {
                cobXM.Items.Add(x.Value);
            }

                for (int c = 0; c <cobXM.Items.Count; c++)
                {
                    string xm = cobXM.Items[c].ToString();
                    if (dftXm.Equals(xm)) { cobXM.SelectedIndex = c; }
                }
                if (dftXm == "") cobXM.SelectedIndex = 0;

            //创建上传数据目录
            Function.dirPrepare();
        }
Beispiel #3
0
 private void button3_Click(object sender, EventArgs e)
 {
     rw_dog dg = new rw_dog();
     MessageBox.Show( dg.jRead(0,256));
 }
Beispiel #4
0
        private void LoginForm_Load(object sender, EventArgs e)
        {
            //删除升级残留文件
            Function.delTempUpdate();

            this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2;
            this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2;

            if (Tools.RunningInstance() != null)
            {
                MessageBox.Show("这个程序已经启动,不能再次打开!");
                this.Close();
                this.Dispose();
                Application.Exit();
                return;
            }
            if (rw_dog.findPort().ToString() == "-92")
            {
                MessageBox.Show("未插入加密狗,请插入后重试!");
                this.Close();
                this.Dispose();
                Application.Exit();//只是程序退出的话后面还会继续执行
                return;
            }
            timer1.Interval = 1000;
            timer1.Start();

            rw_dog dog = new rw_dog();
            userIDTextBox.Text = dog.jRead(220, 4);
            pwdTextBox.Text = dog.jGetID();
            ConfigInfo.Donkey = dog.jGetID();
            dirPrepare();
            loginBtn_Click(null,null);
            //如果验证员工号错误则退出,在判断的地方加退出代码
            //程序逻辑为启动程序->检测加密狗->无则退出,有则验证->正确则进入,错误则退出并提示
        }