예제 #1
0
 /// <summary>
 /// 直接进入开通会员界面
 /// </summary>
 /// <param name="card">若card为null自动生成card</param>
 public OpenMemberView(StructCard card)
 {
     InitializeComponent();
     if (card == null)
     {
         StructCard.Builder newcard = new StructCard.Builder()
         {
             Name         = "xx22",
             Gender       = 1,
             Nation       = "2112",
             Number       = ToolsManage.RandomCard,
             Birthday     = "2012-09-01",
             Address      = "海南省",
             Organization = "海南",
             Head         = "#dasdasd#",
             Vld          = "",
         };
         Bitmap b           = Imgs.test;
         string inputString = ToolsManage.BitmapToDataSring(b);
         newcard.Head = inputString;
         InitUI(newcard.Build());
     }
     else
     {
         InitUI(card);
         IdCardReaderManage.ReadCard(ReadCardResult, null, null);
     }
 }
예제 #2
0
 public UserActiveView(StructCard readCard)
 {
     InitializeComponent();
     this.titleLabel.Text  = "用户上机";
     simpleButton2.Enabled = simpleButton3.Enabled = simpleButton1.Enabled = false;
     IdCardReaderManage.ReadCard(ReadCardResult, null, null);
     InitUI(readCard);
 }
예제 #3
0
 //连接读卡器回调
 private void ConnectReaderResult(bool isSuccess)
 {
     if (!isSuccess)
     {
         this.IsOpenMember = this.IsActiveCard = false;
         IdCardReaderManage.OffCardReader(ReadCardResult, ConnectReaderResult, AuthenticateCardResult);
         MessageBox.Show("请检查读卡器是否连接");
     }
 }
예제 #4
0
        // 激活上网
        private void UserActive_ButtonClick(object sender, EventArgs e)
        {
#if PRODUCT
            //先连接设备进行读卡
            this.IsActiveCard = true;
            IdCardReaderManage.ReadCard(ReadCardResult, ConnectReaderResult, AuthenticateCardResult);
#else
            UserActiveView view = new UserActiveView();
            ToolsManage.ShowForm(view, false);
#endif
        }
예제 #5
0
        //开通会员
        private void OpenMember_ButtonClick(object sender, EventArgs e)
        {
#if PRODUCT
            //先连接设备进行读卡
            this.IsOpenMember = true;
            IdCardReaderManage.ReadCard(ReadCardResult, ConnectReaderResult, AuthenticateCardResult);
#else
            OpenMemberView view = new OpenMemberView(null);
            MainViewManage.ShowView(view);
#endif
        }
예제 #6
0
        //读卡结果
        private void ReadCardResult(StructCard readCard, bool isSuccess)
        {
            if (readCard != null && isSuccess)
            {
                //激活
                RefreshUIHandle active = new RefreshUIHandle(delegate
                {
                    this.IsActiveCard   = false;
                    UserActiveView view = new UserActiveView(readCard);
                    ToolsManage.ShowForm(view, false);
                });
                //开通会员
                RefreshUIHandle open = new RefreshUIHandle(delegate
                {
                    this.IsOpenMember   = false;
                    OpenMemberView view = new OpenMemberView(readCard);
                    MainViewManage.ShowView(view);
                });

                IdCardReaderManage.RemoveEvent(ReadCardResult, ConnectReaderResult, AuthenticateCardResult);
                if (this.InvokeRequired)
                {
                    if (this.IsOpenMember)
                    {
                        this.Invoke(open);
                    }
                    else if (this.IsActiveCard)
                    {
                        this.Invoke(active);
                    }
                }
                else
                {
                    if (this.IsOpenMember)
                    {
                        open();
                    }
                    else if (this.IsActiveCard)
                    {
                        active();
                    }
                }
            }
            else
            {
                this.IsOpenMember = this.IsActiveCard = false;
                IdCardReaderManage.OffCardReader(ReadCardResult, ConnectReaderResult, AuthenticateCardResult);
                MessageBox.Show("读取身份证信息失败");
            }
        }
예제 #7
0
 protected override void RootUserControlView_Disposed(object sender, EventArgs e)
 {
     IdCardReaderManage.OffCardReader(ReadCardResult, null, null);
     base.RootUserControlView_Disposed(sender, e);
 }