public bool RemoveRepository(ILocalizationRepository repository) { repository.MonitorStarted -= OnMonitorStarted; repository.MonitorStopped -= OnMonitorStopped; repository.MonitorNewVersion -= OnMonitorNewVersion; repository.MonitorStop(); var result = _localizationRepositories.Remove(repository); var localizationSource = _localizationSettings.Repositories.FirstOrDefault(r => r.Type == repository.Type && string.Compare(r.Repository, repository.Repository, StringComparison.OrdinalIgnoreCase) == 0); if (localizationSource != null) { _localizationSettings.Repositories.Remove(localizationSource); Program.SaveAppSettings(); } repository.Dispose(); return(result); }