/// <summary> /// The enter of this Program. /// </summary> /// <param name="args">The command line arguments.</param> public static void Main(string[] args) { // Get the subscription Key string subscriptionKey = ConfigurationManager.AppSettings["subscriptionKey"]; if (string.IsNullOrWhiteSpace(subscriptionKey)) { Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("To play this sample, you should firstly get a subscription key and put it into the App.Config file."); Console.WriteLine("If you don't have one, please access"); Console.WriteLine("http://www.projectoxford.ai/doc/general/subscription-key-mgmt"); Console.ResetColor(); Console.WriteLine(); Console.WriteLine("Please enter any key......"); Console.ReadLine(); return; } VisionHelper vision = new VisionHelper(subscriptionKey); string optionStr = string.Empty; string imagePathorUrl = string.Empty; bool quit = false; while (!quit) { ShowMainMenu(); Console.Write("Please choose your option(quit by enter any words):"); optionStr = Console.ReadLine(); switch (optionStr) { case "1": imagePathorUrl = GetValidImagePathorUrl(); vision.AnalyzeImage(imagePathorUrl); break; case "2": imagePathorUrl = GetValidImagePathorUrl(); vision.RecognizeText(imagePathorUrl); break; case "3": imagePathorUrl = GetValidImagePathorUrl(); int width = GetValidWidthorHeight("width"); int height = GetValidWidthorHeight("height"); string folder = GetResultFolder(); bool smartCropping = GetSmartCropping(); vision.GetThumbnail(imagePathorUrl, width, height, smartCropping, folder); break; default: quit = true; break; } } }
/// <summary> /// The enter of this Program. /// </summary> /// <param name="args">The command line arguments.</param> public static void Main(string[] args) { // Get the subscription Key string subscriptionKey = ConfigurationManager.AppSettings["subscriptionKey"]; if (string.IsNullOrWhiteSpace(subscriptionKey)) { Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("To play this sample, you should firstly get a subscription key and put it into the App.Config file."); Console.WriteLine("If you don't have one, please access"); Console.WriteLine("http://www.projectoxford.ai/doc/general/subscription-key-mgmt"); Console.ResetColor(); Console.WriteLine(); Console.WriteLine("Please enter any key......"); Console.ReadLine(); return; } VisionHelper vision = new VisionHelper(subscriptionKey); string optionStr = string.Empty; string imagePathorUrl = string.Empty; bool quit = false; while (!quit) { ShowMainMenu(); Console.Write("Please choose your option(quit by enter any words):"); optionStr = Console.ReadLine(); switch (optionStr) { case "1": imagePathorUrl = GetValidImagePathorUrl(); vision.AnalyzeImage(imagePathorUrl); break; case "2": imagePathorUrl = GetValidImagePathorUrl(); vision.RecognizeText(imagePathorUrl); break; case "3": imagePathorUrl = GetValidImagePathorUrl(); int width = GetValidWidthorHeight("width"); int height = GetValidWidthorHeight("height"); string folder = GetResultFolder(); bool smartCropping = GetSmartCropping(); vision.GetThumbnail(imagePathorUrl, width, height, smartCropping,folder); break; default: quit = true; break; } } }