Esempio n. 1
0
        static void Main(string[] args)
        {
            string endpoint = "ENTER YOUR ENDPOINT HERE";
            string key      = "ENTER YOUR KEY HERE";

            // Anomaly detection samples.
            try
            {
                EntireDetectSample.RunAsync(endpoint, key).Wait();
                LastDetectSample.RunAsync(endpoint, key).Wait();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                if (e.InnerException != null && e.InnerException is APIErrorException)
                {
                    APIError error = ((APIErrorException)e.InnerException).Body;
                    Console.WriteLine("Error code: " + error.Code);
                    Console.WriteLine("Error message: " + error.Message);
                }
                else if (e.InnerException != null)
                {
                    Console.WriteLine(e.InnerException.Message);
                }
            }

            Console.WriteLine("\nPress ENTER to exit.");
            Console.ReadLine();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            // Add your Computer Vision subscription key and endpoint to your environment variables
            string endpoint = Environment.GetEnvironmentVariable("ANOMALY_DETECTOR_ENDPOINT");
            string key      = Environment.GetEnvironmentVariable("ANOMALY_DETECTOR_SUBSCRIPTION_KEY");

            // Anomaly detection samples.
            try
            {
                EntireDetectSample.RunAsync(endpoint, key).Wait();
                LastDetectSample.RunAsync(endpoint, key).Wait();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                if (e.InnerException != null && e.InnerException is APIErrorException)
                {
                    APIError error = ((APIErrorException)e.InnerException).Body;
                    Console.WriteLine("Error code: " + error.Code);
                    Console.WriteLine("Error message: " + error.Message);
                }
                else if (e.InnerException != null)
                {
                    Console.WriteLine(e.InnerException.Message);
                }
            }

            Console.WriteLine("\nPress ENTER to exit.");
            Console.ReadLine();
        }