Ejemplo n.º 1
0
        /// <summary>
        /// The starting point of the application.
        /// </summary>
        /// <param name="args">The command line arguments.</param>
        public static void Main(string[] args)
        {
            try
            {
                // Handle requires arguments

                SessionContext session = ConsoleHelper.GetSessionArguments(args);
                if (session.IsValid())
                {
                    AuthenticationProvider authenticationProvider = new AuthenticationProvider(session.ClientId, session.ClientSecret);

                    // For this sample purpose we will select tha company to use.

                    SetSessionCompanyKeyAsync(session, authenticationProvider).Wait();

                    // For this sample purpose we will allow negative stock on this company.

                    SetAllowNegativeStockAsync(session, authenticationProvider).Wait();

                    // Display Main Menu

                    MenuOptions option = MenuOptions.Exit;
                    do
                    {
                        option = ConsoleHelper.GetMenuOption();
                        if (option != MenuOptions.Exit)
                        {
                            HandleMainMenuOptionAsync(session, authenticationProvider, option).Wait();
                        }
                    } while (option != MenuOptions.Exit);
                }
            }
            catch (Exception ex)
            {
                ConsoleHelper.WriteErrorLine(ex.Message);
                Console.ReadKey();
            }
        }