private void CaptureSign(AreaGrab AG, int currentLetterProgress, char cl) { SignInfo sign = AG.getSign(); SetTextInstruction("Sign Captured"); DialogResult dialogResult = MessageBox.Show("Store this sign?", "Sign Validation", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Sign.AddSign(sign); if (currentLetterProgress >= 10) //checks if the current letter is complete { if (this.CurrentLetter == 'Z') { MessageBox.Show("Training Complete!"); //ends training at Z AG.reset(); this.Close(); } else { cl++; User.SetProgress(UserName, cl); //Updates user progress SetTextLetter(Char.ToString(cl)); } } } SetTextInstruction("Hold up an open hand in front of the kinect"); }
private void TestSign(AreaGrab AG, char CurrentLetter) { SignInfo sign = AG.getSign(); SetTextInstruction("Sign Captured"); if (sign.CheckSign()) { MessageBox.Show("Correct!"); Sign.AddSign(sign); //adds correct signs to make it more accurate } else { MessageBox.Show("Incorrect"); } SetTextInstruction("Hold up an open hand in front of the kinect"); }
private void Train() { char cl = User.GetProgress(UserName); SetTextLetter(Char.ToString(cl)); int currentLetterProgress = Sign.GetSignInfo(UserName, this.CurrentLetter).Count; SetTitle("Training"); AreaGrab AG = new AreaGrab(UserName, this.CurrentLetter); AG.Start(); while (true) { if (AG.ReadyForSign) { cl = User.GetProgress(UserName); currentLetterProgress = Sign.GetSignInfo(UserName, this.CurrentLetter).Count; SetTextInstruction(String.Format("Ready for sign, capturing in {0} seconds", WaitTime/1000)); Thread.Sleep(WaitTime); CaptureSign(AG, currentLetterProgress, cl); } } }
private void Test() { char CurrentLetter = GetTestLetter(); SetTextLetter(Char.ToString(CurrentLetter)); SetTitle("Testing"); AreaGrab AG = new AreaGrab(UserName, CurrentLetter); AG.Start(); while (true) { if (AG.ReadyForSign) { SetTextInstruction(String.Format("Ready for sign, capturing in {0} seconds", WaitTime / 1000)); Thread.Sleep(WaitTime); TestSign(AG, CurrentLetter); } } }