protected void onHeadNodShakeHandler(FaceEvent e) { Action d = () => { if (e.type == FaceEvent.EventType.HeadNodDetected) { MoneyRecord.Create(_lastFaceID, int.Parse(textBox1.Text), DateTime.Now); yue.Text = (int.Parse(yue.Text) + int.Parse(textBox1.Text)).ToString(); _faceCamera.SetSpeakAsync("充值成功,感谢使用"); } else if (e.type == FaceEvent.EventType.HeadShakeDetected) { _faceCamera.SetSpeakAsync("充值取消,欢迎下次光临!"); } _faceCamera.FaceCmd = FaceCamera.FaceCommand.ShotOneAndFind; }; this.BeginInvoke(d); }
protected void onHeadNodShakeHandler(FaceEvent e) { Action d = () => { if (e.type == FaceEvent.EventType.HeadNodDetected) { MoneyRecord.Create(_lastFaceID, -10, DateTime.Now); label_DetectResultHint.Text = "支付成功,祝您用餐愉快!"; _faceCamera.SetSpeakAsync("支付成功,祝您用餐愉快!"); textBox_balance.Text = (int.Parse(textBox_balance.Text) - 10).ToString(); } else if (e.type == FaceEvent.EventType.HeadShakeDetected) { label_DetectResultHint.Text = "付款取消,欢迎下次光临!"; _faceCamera.SetSpeakAsync("付款取消,欢迎下次光临!"); } _faceCamera.FaceCmd = FaceCamera.FaceCommand.ShotOneAndFind; }; this.BeginInvoke(d); }