示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            userInput = pwdTxt.Text;

            if (!IsStart)
            {
                this.Hide();
                return;
            }

            ConfigFileManager passWdFile = new ConfigFileManager();

            if (File.Exists(Constant.ConfigPassWdFilePath))
            {
                passWdFile.LoadFile(Constant.ConfigPassWdFilePath);
            }
            else
            {
                return;
            }

            string pwdTime = "0";

            pwdTime = DateTime.Now.ToString("yyyyMMdd");


            if (userInput.Equals(Pwd))
            {
                //修改下次时间
                DateTime nowAdd = DateTime.Now;

                nowAdd = nowAdd.AddMonths(PwdCount);

                pwdTime = nowAdd.ToString("yyyyMMdd");

                passWdFile.WriteConfig(Constant.passwdTime, pwdTime);

                //修改密码输入的次数
                int pwdInt = 0;

                if (int.TryParse(pwdTime, out pwdInt))
                {
                    PwdCount++;
                    passWdFile.WriteConfig(Constant.passwdCount, PwdCount.ToString());
                }
                this.Close();
            }
            else
            {
                MessageBox.Show(Constant.pwdWrong);
                passWdFile.WriteConfig(Constant.passwdTime, pwdTime);
                Environment.Exit(0);
                this.Close();
            }

            passWdFile.Dispose();
            pwdTxt.Text = "";
        }
示例#2
0
        public EvokDTWork()
        {
            PsLstAuto = new List <DTPlcInfoSimple>();
            PsLstAuto.Add(autoMesOutInPs);
            PsLstAuto.Add(dbcOutInPs);
            PsLstAuto.Add(ltbcOutInPs);
            PsLstAuto.Add(safeOutInPs);
            PsLstAuto.Add(prodOutInPs);
            prodOutInPs.IsParam = false;
            PsLstAuto.Add(lcOutInPs);
            PsLstAuto.Add(stopOutInPs);
            PsLstAuto.Add(cutDoneOutInPs);
            PsLstAuto.Add(plcHandlebarCodeOutInPs);
            PsLstAuto.Add(ldsCountInOutPs);

            PsLstAuto.Add(pauseOutPs);
            PsLstAuto.Add(startOutPs);
            PsLstAuto.Add(resetOutPs);
            PsLstAuto.Add(autoSLOutPs);
            PsLstAuto.Add(pageShiftOutPs);

            PsLstAuto.Add(emgStopInPs);
            PsLstAuto.Add(startInPs);
            PsLstAuto.Add(resetInPs);
            PsLstAuto.Add(pauseInPs);
            PsLstAuto.Add(autoSLInPs);
            PsLstAuto.Add(autoCCInPs);
            PsLstAuto.Add(clInPs);
            PsLstAuto.Add(slInPs);
            PsLstAuto.Add(alarm1InPs);
            PsLstAuto.Add(alarm2InPs);
            PsLstAuto.Add(alarm3InPs);
            PsLstAuto.Add(alarm4InPs);
            PsLstAuto.Add(alarm5InPs);
            PsLstAuto.Add(alarm6InPs);
            PsLstAuto.Add(alarm7InPs);
            PsLstAuto.Add(alarm8InPs);
            PsLstAuto.Add(alarm9InPs);
            PsLstAuto.Add(alarm10InPs);
            PsLstAuto.Add(alarm11InPs);
            PsLstAuto.Add(alarm12InPs);
            PsLstAuto.Add(alarm13InPs);
            PsLstAuto.Add(alarm14InPs);
            PsLstAuto.Add(alarm15InPs);
            PsLstAuto.Add(alarm16InPs);

            PsLstAuto.Add(startCountInOutPs);


            PsLstHand = new List <DTPlcInfoSimple>();


            PsLstParam    = new List <DTPlcInfoSimple>();
            PsLstIO       = new List <DTPlcInfoSimple>();
            UserDataTable = new DataTable();

            AllPlcSimpleLst = new List <List <DTPlcInfoSimple> >();

            AllPlcSimpleLst.Add(psLstAuto);
            AllPlcSimpleLst.Add(psLstHand);
            AllPlcSimpleLst.Add(psLstParam);
            AllPlcSimpleLst.Add(PsLstIO);

            paramFile = new ConfigFileManager();

            if (File.Exists(Constant.ConfigParamFilePath))
            {
                paramFile.LoadFile(Constant.ConfigParamFilePath);

                if (!int.TryParse(paramFile.ReadConfig(Constant.printBarcodeMode), out printBarCodeMode))
                {
                    MessageBox.Show(Constant.ErrorParamConfigFile);

                    ConstantMethod.AppExit();
                }
            }
            else
            {
                MessageBox.Show(Constant.ConfigParamFilePath + Constant.ErrorParamConfigFile);
                ConstantMethod.AppExit();
            }

            LogManager.WriteProgramLog(Constant.Start);
        }