private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                speechSynthesizer.SpeakAsync("Hi Visitor, Welcome to the new world of NCR.");
                await Task.Delay(1000);

                speechSynthesizer.SpeakAsync("To verify your face. Please put your face clearly infront of the ATM.");

                SpeakerIdentificationServiceClient _serviceClient = new SpeakerIdentificationServiceClient(speakerAPISubscriptionKey);

                bool groupExists = false;

                var faceServiceClient = new FaceServiceClient(faceAPISubscriptionKey);
                // Test whether the group already exists
                try
                {
                    Title = String.Format("Request: Group {0} will be used to build a person database. Checking whether the group exists.", GroupName);
                    Console.WriteLine("Request: Group {0} will be used to build a person database. Checking whether the group exists.", GroupName);

                    await faceServiceClient.GetPersonGroupAsync(GroupName);

                    groupExists = true;
                    Title       = String.Format("Response: Group {0} exists.", GroupName);
                    Console.WriteLine("Response: Group {0} exists.", GroupName);
                }
                catch (FaceAPIException ex)
                {
                    if (ex.ErrorCode != "PersonGroupNotFound")
                    {
                        Title = String.Format("Response: {0}. {1}", ex.ErrorCode, ex.ErrorMessage);
                        return;
                    }
                    else
                    {
                        Title = String.Format("Response: Group {0} did not exist previously.", GroupName);
                    }
                }

                if (groupExists)
                {
                    Title = String.Format("Success..... Now your Group  {0} ready to use.", GroupName);
                    webcam.Start();
                    return;
                }

                else
                {
                    Console.WriteLine("Group did not exist. First you need to create a group");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : ", ex.Message);
            }
        }
Exemple #2
0
 public MainWindow()
 {
     InitializeComponent();
     InitializeRecorder();
     Task.Delay(3000);
     webcam = new webCam();
     webcam.InitializeWebCam(ref webImage);
     webcam.Start();
     Task.Delay(2000);
     InitializeRecorder();
     Task.Delay(3000);
     speechSynthesizer = new SpeechSynthesizer();
     withdraw          = new Withdraw();
     transaction       = new Transaction();
 }
 public MainWindow()
 {
     InitializeComponent();
     InitializeRecorder();
     Task.Delay(2000);
     webcam = new webCam();
     webcam.InitializeWebCam(ref webImage);
     webcam.Start();
     Task.Delay(2000);
     InitializeRecorder();
     Task.Delay(2000);
     speechSynthesizer      = new SpeechSynthesizer();
     speechSynthesizer.Rate = -1;
     timer          = new DispatcherTimer();
     timer.Interval = new TimeSpan(0, 0, 1);
     timer.Tick    += Timer_Tick;
 }