private void RunSingleUpdateFromMultipleInstance(DbUpdaterMultipleSourceConfigurationSection settings, LogWrapper.ILogger logger, int configurationIndex, CommandLineParams commandLineParams) { if (settings == null || settings.DbUpdaterConfigurations == null) { OnFinishUpdateProcess(false); return; } if (configurationIndex >= settings.DbUpdaterConfigurations.Count) { OnFinishUpdateProcess(false); return; } DbUpdaterConfigurationSection currentSettings = settings.DbUpdaterConfigurations[configurationIndex]; if (string.IsNullOrEmpty(currentSettings.ConnectionString)) { currentSettings.ConnectionString = settings.ConnectionString; } RunSingleUpdate(currentSettings, logger, settings, configurationIndex + 1, commandLineParams); }
private void RunSingleUpdate(DbUpdaterConfigurationSection settings, LogWrapper.ILogger logger, DbUpdaterMultipleSourceConfigurationSection multipleSettings, int configurationIndex, CommandLineParams commandLineParams) { var bw = new BackgroundWorker(); bw.WorkerReportsProgress = true; bw.DoWork += (sender, args) => { var updater = new UpdateManager(settings, logger, commandLineParams); updater.UpdateProgress += (s, e) => bw.ReportProgress(0, e); updater.Update(); }; bw.ProgressChanged += Update_ProgressChanged; bw.RunWorkerCompleted += (s, e) => { IsUpdateInProgress = false; if (e.Error != null) { DisplayText += "Error: " + e.Error.Message +Environment.NewLine; OnFinishUpdateProcess(true); return; } if (e.Cancelled) { DisplayText += "Cancelled" + Environment.NewLine; OnFinishUpdateProcess(true); return; } RunSingleUpdateFromMultipleInstance(multipleSettings, logger, configurationIndex, commandLineParams); }; IsUpdateInProgress = true; bw.RunWorkerAsync(); }