private async void GetStaffData(int id, bool isFaceID) { // 获取员工名字 this.staffName = await Service.GetStaffName(id); Log.WriteLog(string.Format("INFO-BOW:读取人员信息成功,匹配人员--{0}。", this.staffName)); this.txtStaffID.IsEnabled = true; if (string.IsNullOrEmpty(this.staffName)) { this.tbFaceError.Text = "员工未登记,请联系管理员!"; return; } if (this.imgPhoto.Source != null) { (this.imgPhoto.Source as BitmapImage).UriSource = null; this.imgPhoto.Source = null; } this.tbHello.Text = string.Format("你好,{0}!", this.staffName); this.imgPhoto.Source = BmpUtil.GetBitmapImage(isFaceID ? "pack://siteoforigin:,,,/model.jpg" : "pack://application:,,,/Images/person.png"); this.contentGrid.Visibility = Visibility.Visible; this.faceGrid.Visibility = Visibility.Collapsed; // 查询用户数据 this.GetData(); }
private void StackPanel_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (txtAction.Tag.ToString() == "ID") { txtAction.Tag = "FACE"; txtAction.Text = "使用人脸识别"; this.imgAction.Source = BmpUtil.GetBitmapImage("pack://application:,,,/Images/faceid.png"); this.faceAni.Visibility = Visibility.Collapsed; this.spIdLogin.Visibility = Visibility.Visible; this.txtStaffID.IsEnabled = true; } else { txtAction.Tag = "ID"; txtAction.Text = "使用工号登录"; this.imgAction.Source = BmpUtil.GetBitmapImage("pack://application:,,,/Images/people.png"); this.faceAni.Visibility = Visibility.Visible; this.spIdLogin.Visibility = Visibility.Collapsed; } }