Example #1
0
        private string SelectRegion(AzurePrepInputs inputs)
        {
            Console.WriteLine("Retrieving a list of Locations...");
            string[] regions      = AzureProvider.GetRegions(inputs.Credentials);
            int      regionsCount = regions.Length;

            Console.WriteLine("Available locations: ");

            for (int currentRegion = 1; currentRegion <= regionsCount; ++currentRegion)
            {
                Console.WriteLine(currentRegion + ": " + regions[currentRegion - 1]);
            }

            for ( ;;)
            {
                Console.WriteLine("Please select Location from list: ");

                string answer    = Console.ReadLine( );
                int    selection = 0;
                if (!int.TryParse(answer, out selection) || selection > regionsCount || selection < 1)
                {
                    Console.WriteLine("Incorrect Location number.");
                    continue;
                }

                if (ConsoleHelper.Confirm("Are you sure you want to select location " + regions[selection - 1] + "?"))
                {
                    return(regions[selection - 1]);
                }
            }
        }
Example #2
0
        private string SelectRegion(AzurePrepInputs inputs)
        {
            Console.WriteLine("Retrieving a list of Locations...");
            string[] regions      = AzureProvider.GetRegions(inputs.Credentials);
            int      regionsCount = regions.Length;

            Console.WriteLine("Available locations: ");

            for (int currentRegion = 1; currentRegion <= regionsCount; ++currentRegion)
            {
                string suffixMessage = string.Empty;
                if (regions[currentRegion - 1] == "East US")
                {
                    //see https://github.com/MSOpenTech/connectthedots/issues/168
                    suffixMessage = " (creating new Resource Group is not supported)";
                }
                Console.WriteLine(currentRegion + ": " + regions[currentRegion - 1] + suffixMessage);
            }

            for ( ;;)
            {
                Console.WriteLine("Please select Location from list: ");

                string answer    = Console.ReadLine( );
                int    selection = 0;
                if (!int.TryParse(answer, out selection) || selection > regionsCount || selection < 1)
                {
                    Console.WriteLine("Incorrect Location number.");
                    continue;
                }

                if (ConsoleHelper.Confirm("Are you sure you want to select location " + regions[selection - 1] + "?"))
                {
                    return(regions[selection - 1]);
                }
            }
        }