Esempio n. 1
0
        /// <summary>
        /// Method with logic of execution the Console Application which created shell to process
        /// data.
        /// </summary>
        /// <param name="args">Represents the command-line arguments.</param>
        /// <param name="shell">Represents the main manager of the library.</param>
        private static async Task Run(IReadOnlyList <string> args, ShellAsync shell)
        {
            ServiceStatus status;

            if (args.Count == 1)
            {
                status = await shell.Run(args[0]);
            }
            else
            {
                GlobalMessageHandler.OutputMessage(
                    "Enter filename which contains the Things: "
                    );
                status = await shell.Run(GlobalMessageHandler.GetMessage());
            }

            if (status == ServiceStatus.Nothing)
            {
                GlobalMessageHandler.OutputMessage("Result is empty. Closing...");
            }
            else
            {
                GlobalMessageHandler.OutputMessage("Work was finished! Press enter to exit...");
            }
            GlobalMessageHandler.GetMessage();
        }
Esempio n. 2
0
        /// <summary>
        /// Method with logic of execution the Console Application which created shell to process data.
        /// </summary>
        /// <param name="args">Represents the command-line arguments.</param>
        /// <param name="shell">Represents the main manager of the library.</param>
        private static void Run(string[] args, ShellAsync shell)
        {
            ServiceStatus status;

            if (args.Length == 1)
            {
                status = shell.Run(args[0]).Result;
            }
            else
            {
                GlobalMessageHandler.OutputMessage(
                    "Enter filename which contains the Things: "
                    );
                status = shell.Run(GlobalMessageHandler.GetMessage()).Result;
            }

            if (status == ServiceStatus.Nothing)
            {
                GlobalMessageHandler.OutputMessage("Result is empty. Closing...");
            }
            else
            {
                GlobalMessageHandler.OutputMessage("Work was finished! Press enter to exit...");
            }
            GlobalMessageHandler.GetMessage();
        }
Esempio n. 3
0
        private async Task <IReadOnlyList <ServiceStatus> > ExecuteSpecifiedNumberOfTimes(
            ShellAsync shell)
        {
            var statuses = new List <ServiceStatus>(ExecutionsNumber);

            int executedCount = 0;

            while (true)
            {
                ServiceStatus status = await shell.Run("Processing request data.");

                statuses.Add(status);

                ++executedCount;

                if (executedCount == ExecutionsNumber)
                {
                    break;
                }

                await Task.Delay(DelayTime);
            }

            return(statuses);
        }