/// <summary> /// 3rd phase of test: check 3 finger swipe. /// </summary> private void PhaseThree(NativeMethods.TOUCHINPUT[] touchInputs) { if (PhaseThree_point == 0) { PassPhaseThree = true; } else if (PhaseThree_point >= 1) { InstructionLbl.Text = string.Format(LocRM.GetString("TouchTest3"), PhaseThree_point); LeftPanel.Visible = true; RightPanel.Visible = true; TouchPanel.SetRowSpan(LeftPanel, 5); TouchPanel.SetRowSpan(RightPanel, 5); int rightPointsCount = 0; //if less than 3 touch point, restart over if (touchInputs.Length < PhaseThree_point) { LeftPanel.BackColor = Color.Crimson; threePoints.Clear(); rightPointsCount = 0; } else { for (int i = 0; i < touchInputs.Length; i++) { Point screenPoint = new Point(touchInputs[i].x / 100, touchInputs[i].y / 100); Point winPoint = TouchPanel.PointToClient(screenPoint); Control c = TouchPanel.GetChildAtPoint(winPoint); if (c == LeftPanel && touchInputs.Length >= PhaseThree_point && LeftPanel.BackColor == Color.Crimson) { if (!threePoints.Contains(touchInputs[i].dwID.ToString())) { threePoints.Add(touchInputs[i].dwID.ToString()); } if (threePoints.Count >= PhaseThree_point) { LeftPanel.BackColor = Color.YellowGreen; } } if (c == RightPanel && touchInputs.Length >= PhaseThree_point && LeftPanel.BackColor == Color.YellowGreen) { if (threePoints.Contains(touchInputs[i].dwID.ToString())) { rightPointsCount++; if (rightPointsCount >= PhaseThree_point) { RightPanel.BackColor = Color.YellowGreen; InstructionLbl.Text = "Pass"; PassPhaseThree = true; } } } }//end of for loop on touchpoints } } }