Example #1
0
        protected void DoOpenCard()
        {
            try
            {
                //连接设备
                bool result = m_E7Device.OpenDevice();
                while (!result)
                {
                    result = m_E7Device.OpenDevice();
                    Thread.Sleep(1000);
                }

                //读卡
                this.Invoke(new Action(() =>
                {
                    frmOpenCardDialog.SetfrmWaitDialogType(frmWaitDialogType.WaitReadCard);
                }));

                m_E7Device.DisplayLcd("请刷卡或把卡放在卡槽上");

                result = m_E7Device.FindCard();
                while (!result)
                {
                    Thread.Sleep(1000);
                    result = m_E7Device.FindCard();
                }


                //写卡
                string newcardid = m_E7Device.CreateNewCardId();
                result = m_E7Device.WriteLogicCardId(newcardid);

                if (result)
                {
                    this.Invoke(new Action(() =>
                    {
                        frmOpenCardDialog.Close();
                        m_Browser.StringByEvaluatingJavaScriptFromString(string.Format("addStoreCardId ('{0}')", newcardid));
                    }));

                    m_E7Device.Beep();
                    //m_E7Device.DisplayLcd("      点菜100", "餐饮管理服务云平台");
                }
                else
                {
                    this.Invoke(new Action(() =>
                    {
                        frmOpenCardDialog.SetfrmWaitDialogType(frmWaitDialogType.WriteCardFailed);
                    }));
                }
            }
            catch (Exception E)
            {
                Global.GetLogger().Error("MemberSystem", "DoOpenCard", E);
            }
            finally
            {
                m_E7Device.CloseDevice();
            }
        }
Example #2
0
        private void DoReadUserPSW()
        {
            try
            {
                //连接设备
                bool result = m_E7Device.OpenDevice();
                while (!result)
                {
                    result = m_E7Device.OpenDevice();
                    Thread.Sleep(1000);
                }


                //输入密码
                this.Invoke(new Action(() =>
                {
                    frmInputPSWDialog.SetfrmWaitDialogType(frmWaitDialogType.WaitInputPSW);
                }));

                m_E7Device.DisplayLcd("请输入密码!");

                string userpsw = m_E7Device.ReadUserPSW();
                this.Invoke(new Action(() =>
                {
                    m_Browser.StringByEvaluatingJavaScriptFromString(string.Format("addPassword ('{0}')", userpsw));
                }));
            }
            catch
            {
            }
            finally
            {
                try
                {
                    this.BeginInvoke(new Action(() =>
                    {
                        frmInputPSWDialog.Close();
                    }));
                }
                catch
                {
                }

                m_E7Device.CloseDevice();
            }
        }