コード例 #1
0
        // automated backups looper feels like a composible IProcessable: logic, UI, begin + process child + end
        // however the process step doesn't follow the pattern: Validate(product) + Process(product)
        private static async Task runBackupLoopAsync(IProcessable processable, AutomatedBackupsForm automatedBackupsForm)
        {
            automatedBackupsForm.Show();

            try
            {
                var shouldContinue = true;
                while (shouldContinue)
                {
                    var statusHandler = await processable.ProcessFirstValidAsync();

                    shouldContinue = validateStatus(statusHandler, automatedBackupsForm);
                }
            }
            catch (Exception ex)
            {
                automatedBackupsForm.AppendError(ex);
            }

            automatedBackupsForm.FinalizeUI();
        }