private void LoadConfiguration() { //Should an error occur this.errorDelegation = new ErrorDelegation(ShowError); this.synchronizationDelegation = new SynchronizationDelegation(ShowProgress); this.frmSynchronize = new FrmSynchronize(); //Load the previous configuration this.configuration = new Configuration(errorDelegation); }
/// <summary> /// Tries to load a configuration from XML. If none or corrupt XML found, a default /// Configuration is loaded. /// </summary> /// <param name="errorDelegation">Delegation called when no or corrupt XML is found.</param> public Configuration(ErrorDelegation errorDelegation) { this.errorDelegation = errorDelegation; try { Configuration loadedConfiguration = ConfigurationSource.Load(); this.Recipients = loadedConfiguration.Recipients; this.Background = loadedConfiguration.Background; this.Database = loadedConfiguration.Database; this.Password = loadedConfiguration.Password; this.Server = loadedConfiguration.Server; this.Table = loadedConfiguration.Table; this.Color = loadedConfiguration.Color; this.User = loadedConfiguration.User; this.Font = loadedConfiguration.Font; this.Logo = loadedConfiguration.Logo; this.Row = loadedConfiguration.Row; } catch { errorDelegation(ERROR_LOADING_CONFIGURATION); new Configuration(); } }
private void ErrorHandling() { //Make sure errors get displayed errorDelegation = new ErrorDelegation(ShowError); }