Esempio n. 1
0
        public string readKeyInPass()
        {
            if (iDevice <= 0)
            {
                return("");
            }

            int           state = -1;
            StringBuilder temp  = new StringBuilder();

            initPassState(120);
            do
            {
                //state:0 完成输入
                //161:输入密码长度过长,最长密码为25个数字
                //162:,取消密码输入
                //163:未处于密码输入状态
                //164:,用户输入密码还未完成
                //165:,用户密码输入操作超时
                Byte[] tempPass = new Byte[6];//6位密码

                Byte lenpass = 0;
                state = E7Lib.fw_PassGet(iDevice, ref lenpass, ref tempPass[0]);
                int statePassKey = E7Lib.fw_CheckKeyValue(iDevice, ref lenpass, ref tempPass[0]);
                //cancelPassState();
                if (lenpass > 6)
                {
                    //等待用户按确认
                    continue;
                }
                if (statePassKey == 0 && state != 0 && lenpass > 0 && lenpass != temp.Length)
                {
#if DEBUG
                    temp.Append(((char)tempPass[lenpass - 1]).ToString());
#else
                    temp.Append("*");
#endif


                    showStringLCD2Lines("请输入密码!", GetDisplayPsw(temp.ToString()));
                }
                if (state == 0 || state == 162)
                {
                    //输入完成或者取消,跳出循环
                    break;
                }
            } while (state != 161 &&
                     state != 162 &&
                     state != 165 &&
                     state != 0);
            if (0 == state)
            {
                showStringLCD2Lines("输入完成!", "");
                return(temp.ToString());
            }
            return("");
        }