コード例 #1
0
        public async Task <ProcessingResponse> ProcessRequest(RequestData requestData)
        {
            var builderDirector = ShellAsync.CreateBuilderDirector(
                XmlConfigCreator.TransformConfigToXDocument(requestData.ConfigurationXml)
                );
            var shell = builderDirector.MakeShell();

            var inputTransmitter = new CInputTransmitterAsync(requestData.ThingNames);

            shell.InputManagerAsync.Add(inputTransmitter);

            var outputTransmitter = new OutputTransmitterAsync();

            shell.OutputManagerAsync.Add(outputTransmitter);

            ServiceStatus status = await shell.Run("Processing response");

            var results  = outputTransmitter.GetResults();
            var response = new ProcessingResponse
            {
                MetaData = new ResponseMetaData
                {
                    CommonResultsNumber = results.Aggregate(
                        0, (counter, rating) => counter + rating.Count
                        ),
                    CommonResultCollectionsNumber = results.Count,
                    ResultStatus = status,
                    OptionalData = CreateOptionalData()
                },
                RatingDataContainers = results
            };

            return(response);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: danila19991/ThingAppraiser
        /// <summary>
        /// Main method of the Console Application which using config to manipulate Shell.
        /// </summary>
        /// <param name="args">Represents the command-line arguments.</param>
        private static void MainXDocument(string[] args)
        {
            // Show the case when we have a movies to appraise.
            var builderDirector = ShellAsync.CreateBuilderDirector(
                XmlConfigCreator.CreateDefaultXmlConfigAsXDocument()
                );
            var shell = builderDirector.MakeShell();

            Run(args, shell);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: fossabot/ThingAppraiser
        /// <summary>
        /// Main method of the Console Application which using config to manipulate Shell.
        /// </summary>
        /// <param name="args">Represents the command-line arguments.</param>
        private static async Task MainXDocument(IReadOnlyList <string> args)
        {
            // Show the case when we have a movies to appraise.
            var builderDirector = ShellAsync.CreateBuilderDirector(
                XmlConfigCreator.CreateDefaultXmlConfigAsXDocument()
                );
            var shell = builderDirector.MakeShell();

            await Run(args, shell);
        }
コード例 #4
0
ファイル: SimpleTask.cs プロジェクト: Vasar007/ProjectV
        public async Task <IReadOnlyList <ServiceStatus> > ExecuteAsync(RequestData requestData,
                                                                        IInputterAsync additionalInputterAsync, IOutputterAsync additionalOutputterAsync)
        {
            ShellAsyncBuilderDirector builderDirector = ShellAsync.CreateBuilderDirector(
                XmlConfigCreator.TransformConfigToXDocument(requestData.ConfigurationXml)
                );

            using ShellAsync shell = builderDirector.MakeShell();

            shell.InputManagerAsync.Add(additionalInputterAsync);
            shell.OutputManagerAsync.Add(additionalOutputterAsync);

            return(await ExecuteSpecifiedNumberOfTimes(shell));
        }