Esempio n. 1
0
        void GiveUser(User current)
        {
            faceTrackingViewer.stopTracking();
            this.isfaceTrackerOn = false;
            if (this.isUserNew)
            {
                if (current.name.Length > 0)
                {

                    faceTrackingViewer.stopTracking();
                    this.isfaceTrackerOn = false;
                    this.scanpanel.Visibility = System.Windows.Visibility.Collapsed;
                    if (string.Compare(this.currentUser.name, current.name, true) == 0)
                    {
                        this.welcomeMassage.Text = "We have found your scan if thats incorecct click on rescan!";
                        this.welcomeMassage.Visibility = System.Windows.Visibility.Visible;
                        this.rescan.Visibility = System.Windows.Visibility.Visible;
                    }
                }
                else
                {
                    // new user registering, start learner
                    faceTrackingViewer.stopTracking();
                    this.isfaceTrackerOn = false;
                    this.currentUser.faceParams = current.faceParams;
                    this.currentUser.name = this.Username.Text;
                    this.scanpanel.Visibility = System.Windows.Visibility.Collapsed;
                    this.ImagePanel.Visibility = System.Windows.Visibility.Visible;

                }

            }

            else
            {
                if (current.name.Length > 0)
                {
                    if (String.Compare(current.name, this.currentUser.name, true) == 0)
                    {
                        faceTrackingViewer.stopTracking();
                        this.isfaceTrackerOn = false;
                        Console.WriteLine("The name is " + current.name);
                        this.scanpanel.Visibility = System.Windows.Visibility.Collapsed;
                        this.InitialPanel.Visibility = System.Windows.Visibility.Visible;
                        this.New_Account.Visibility = System.Windows.Visibility.Collapsed;
                        this.login.Visibility = System.Windows.Visibility.Collapsed;
                        this.rescan.Visibility = System.Windows.Visibility.Collapsed;
                        this.welcomeMassage.Visibility = System.Windows.Visibility.Visible;

                        this.welcomeMassage.Text = "Hello " + current.name + "! " + "Start drawing your pattern when the circle is blue.";

                        userImage = new BitmapImage(new Uri(current.imgPath));
                        myImageBox.Source = handSource;
                        this.myImageBox.Visibility = Visibility.Visible;
                        this.sensor.DepthFrameReady += this.SensorDepthFrameReady;
                        this.sensor.SkeletonFrameReady += this.SensorSkeletonFrameReady;
                        Queue<ThreeDAuth.Point2d> passwordQueue = new Queue<ThreeDAuth.Point2d>(current.password);
                        gValidator = new ThreeDAuth.GestureValidator(passwordQueue, 20);
                        gValidator.OnCompletedValidation += new CompletedValidation(gValidator_OnCompletedValidation);

                    }
                    else
                    {

                        faceTrackingViewer.stopTracking();
                        this.isfaceTrackerOn = false;
                        Console.WriteLine("The name is " + current.name);
                        this.scanpanel.Visibility = System.Windows.Visibility.Collapsed;
                        this.InitialPanel.Visibility = System.Windows.Visibility.Visible;
                        this.New_Account.Visibility = System.Windows.Visibility.Collapsed;
                        this.login.Visibility = System.Windows.Visibility.Collapsed;
                        this.rescan.Visibility = System.Windows.Visibility.Visible;
                        this.byPass.Visibility = System.Windows.Visibility.Visible;
                        this.welcomeMassage.Visibility = System.Windows.Visibility.Visible;
                        this.welcomeMassage.Text = "Hello " + this.currentUser.name + "! " + "We did not find the right match. Please rescan";
                    }
                }
                else
                {
                    faceTrackingViewer.stopTracking();
                    this.isfaceTrackerOn = false;
                    Console.WriteLine("The name is " + current.name);
                    this.scanpanel.Visibility = System.Windows.Visibility.Collapsed;
                    this.InitialPanel.Visibility = System.Windows.Visibility.Visible;
                    this.New_Account.Visibility = System.Windows.Visibility.Collapsed;
                    this.login.Visibility = System.Windows.Visibility.Collapsed;
                    this.rescan.Visibility = System.Windows.Visibility.Visible;
                    this.byPass.Visibility = System.Windows.Visibility.Visible;
                    this.welcomeMassage.Visibility = System.Windows.Visibility.Visible;
                    this.welcomeMassage.Text = "Hello " + this.Username.Text + "! " + "We did not find you. Please rescan";

                }

            }
        }
Esempio n. 2
0
        private void byPass_Click(object sender, RoutedEventArgs e)
        {
            if (data == null)
            {
                data = new XmlDocument();
            }
            this.rescan.Visibility = System.Windows.Visibility.Collapsed;
            this.welcomeMassage.Visibility = System.Windows.Visibility.Collapsed;

            try
            {
                data.Load("users.xml");
            }
            catch (Exception exception)
            {
                Console.WriteLine("file not found");
            }

            SortedDictionary<String, double> matches = new SortedDictionary<String, double>();

            XmlNodeList users = data.GetElementsByTagName("user");

            foreach (XmlNode user in users)
            {
                if (String.Compare(user["name"].InnerText, this.currentUser.name, true) == 0)
                {

                    this.currentUser.imgPath = user["user-image"].InnerText;

                    List<Point2d> tempPts = new List<Point2d>();
                    XmlNode points = user["points"];
                    for (int i = 0; i < points.ChildNodes.Count; i++)
                    {
                        XmlNode point = points.ChildNodes[i];
                        double x = Convert.ToDouble(point["x"].InnerText);
                        double y = Convert.ToDouble(point["y"].InnerText);
                        Point2d tmp = new Point2d(x, y);
                        tempPts.Add(tmp);
                    }

                    this.currentUser.password = tempPts;

                    this.byPass.Visibility = System.Windows.Visibility.Collapsed;
                    this.welcomeMassage.Visibility = System.Windows.Visibility.Visible;
                    this.welcomeMassage.Text = "Hello " + this.currentUser.name + "! " + "Start drawing your pattern when the circle is blue.";
                    userImage = new BitmapImage(new Uri(this.currentUser.imgPath));
                    myImageBox.Source = handSource;
                    this.myImageBox.Visibility = Visibility.Visible;
                    this.sensor.DepthFrameReady += this.SensorDepthFrameReady;
                    this.sensor.SkeletonFrameReady += this.SensorSkeletonFrameReady;
                    Queue<ThreeDAuth.Point2d> passwordQueue = new Queue<ThreeDAuth.Point2d>(this.currentUser.password);
                    gValidator = new ThreeDAuth.GestureValidator(passwordQueue, 20);
                    gValidator.OnCompletedValidation += new CompletedValidation(gValidator_OnCompletedValidation);
                }
            }
        }
Esempio n. 3
0
 private void SetGestureValidator(GestureValidator validator)
 {
     validator.OnDistanceUpdated += new UpdateTargetDistance(AddDistance);
 }
Esempio n. 4
0
 private void Validate_Click(object sender, RoutedEventArgs e)
 {
     if (gLearner.isRecording)
     {
         gLearner.stopRecording();
     }
     System.Collections.Generic.Queue<ThreeDAuth.Point2d> path = gLearner.getGesturePath();
     if (path != null)
     {
         gValidator = new ThreeDAuth.GestureValidator(path, 50);
         gValidator.beginPath();
     }
 }
Esempio n. 5
0
 private void SetGestureValidator(GestureValidator validator)
 {
     validator.OnDistanceUpdated += new UpdateTargetDistance(AddDistance);
 }