public ReturnView() { InitializeComponent(); txtStaffID.AddHandler(TextBox.MouseLeftButtonDownEvent, new MouseButtonEventHandler(txtStaffID_MouseLeftButtonDown), true); timer.Tick += Timer_Tick; timer.Interval = TimeSpan.FromSeconds(1); faceIdUtil = new FaceIDUtil(); faceIdUtil.FaceSearchCompleted += FaceIdUtil_FaceSearchCompleted; string err = ""; if ((err = faceIdUtil.Init()) != "") { this.tbFaceError.Text = err; } this.listBox.ItemsSource = dataList; spCard.DataReceived += spCard_DataReceived; spCard.Error += spCard_Error; // 打开读卡器监听 SpConfig spConfig = new SpConfig(); spConfig.PortName = ConfigurationManager.AppSettings["CardPort"]; spConfig.BaudRate = 19200; // 波特率 spConfig.Parity = System.IO.Ports.Parity.Even; // 偶校验位 spConfig.DataBits = 8; spConfig.StopBits = System.IO.Ports.StopBits.One; // 停止位 spCard.Open(spConfig); // 设置读卡器为主动模式 string msg = "02 06 00 00 00 03 C9 F8"; var flag = spCard.Write(msg); if (!flag) { Log.WriteLog(string.Format("ERROR-RET:主动模式设置失败,{0}", msg)); } spCabinet.DataReceived += SpCabinet_DataReceived; spCabinet.Error += SpCabinet_Error; //string[] cameras = MultimediaUtil.VideoInputNames;//获取摄像头 //if (cameras.Length > 0) //{ // this.videoPlayer.VideoCaptureSource = cameras[0]; //} new Thread(() => { Thread.Sleep(100); faceIdUtil.OpenRealData(); }).Start(); }
public BorrowView() { InitializeComponent(); txtStaffID.AddHandler(TextBox.MouseLeftButtonDownEvent, new MouseButtonEventHandler(txtStaffID_MouseLeftButtonDown), true); timer.Tick += Timer_Tick; timer.Interval = TimeSpan.FromSeconds(1); faceIdUtil = new FaceIDUtil(); faceIdUtil.FaceSearchCompleted += FaceIdUtil_FaceSearchCompleted; string err = ""; if ((err = faceIdUtil.Init()) != "") { this.tbFaceError.Text = err; } this.listBox.ItemsSource = dataList; spCabinet.DataReceived += SpFactory_DataReceived; spCabinet.Error += SpFactory_Error; //string[] cameras = MultimediaUtil.VideoInputNames; // 获取摄像头 //if (cameras.Length > 0) //{ // this.videoPlayer.VideoCaptureSource = cameras[0]; //} //this.videoPlayer.MediaOpened += VideoPlayer_MediaOpened; new Thread(() => { Thread.Sleep(100); faceIdUtil.OpenRealData(); }).Start(); }