示例#1
0
 private async void ButtonGetData_Click(object sender, RoutedEventArgs e)
 {
     // Show file picker dialog
     var dlg = new Microsoft.Win32.OpenFileDialog
     {
         DefaultExt = ".jpg",
         Filter = "Image files(*.jpg) | *.jpg"
     };
     var result = dlg.ShowDialog();
     if (!result.HasValue || !result.Value) return;
     SelectedFile = dlg.FileName;
     var faceApi = new FaceApiHelper();
     var returnData = await faceApi.StartFaceDetection(SelectedFile, "4c138b4d82b947beb2e2926c92d1e514");
     DetectedFaces = returnData.Item1;
     FacesRect = returnData.Item2;
 }
        private async void ButtonGetData_Click(object sender, RoutedEventArgs e)
        {
            // Show file picker dialog
            var dlg = new Microsoft.Win32.OpenFileDialog
            {
                DefaultExt = ".jpg",
                Filter = "Image files(*.jpg) | *.jpg"
            };
            var result = dlg.ShowDialog();
            if (!result.HasValue || !result.Value) return;
            SelectedFile = dlg.FileName;
            var faceApi = new FaceApiHelper();
            var returnData = await faceApi.StartFaceDetection(SelectedFile, Properties.Settings.Default.FaceApiKey, Properties.Settings.Default.EmotionsApiKey);
            DetectedFaces = returnData.Item1;
            FacesRect = returnData.Item2;

            StatusInformation = $@"{DetectedFaces.Count} faces datected.";
        }