Exemplo n.º 1
0
        async static Task LoadKey(FrameAnalyzer fa)
        {
            var packageFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
            var sFile         = await packageFolder.GetFileAsync("cognitive_service.key");

            var key = await Windows.Storage.FileIO.ReadTextAsync(sFile);

            fa.serviceKey = key;
        }
Exemplo n.º 2
0
        public static async Task <FrameAnalyzer> CreateAsync()
        {
            var fa = new FrameAnalyzer();

            await LoadKey(fa);

            if (string.IsNullOrEmpty(fa.serviceKey))
            {
                throw new Exception("service key unavailable or invalid");
            }

            fa.visionClient = new WesteuropeFaceServiceClient(fa.serviceKey);

            return(fa);
        }