Пример #1
0
        /// <inheritdoc/>
        public async Task StartAsync()
        {
            Console.Clear();
            Cifra.Application.Models.Class.Class chosenClass = await AskForClassAsync();

            Cifra.Application.Models.Test.Test chosenTest = await AskForTestAsync();

            Console.Clear();
            string fileName = SharedConsoleFlows.AskForString("What should be the name of the spreadsheet?");

            SaveResult saveResult = await BuildSpreadsheetAsync(chosenClass, chosenTest, fileName);

            if (saveResult.IsSuccess)
            {
                Console.WriteLine("File successfully saved.");
                SharedConsoleFlows.AskForAnyKey("Press any key to go back");
            }
            else
            {
                Console.WriteLine("File not saved due to an error.");
                SharedConsoleFlows.AskForAnyKey("Press any key to go back");
            }
        }
Пример #2
0
        private async Task <SaveResult> BuildSpreadsheetAsync(Cifra.Application.Models.Class.Class chosenClass, Cifra.Application.Models.Test.Test chosenTest, string fileName)
        {
            var metadata = new Metadata
            {
                Title              = fileName,
                Subject            = fileName,
                Author             = "Todo",
                Created            = DateTime.Now,
                FileName           = fileName,
                ApplicationVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(3)
            };

            return(await _spreadsheetFactory.CreateTestResultsSpreadsheetAsync(chosenClass, chosenTest, metadata));
        }