Exemplo n.º 1
0
        private List <ConnectionGroup> Load()
        {
            var newRepo = new NewRepositoryReader(_knownConnections);

            try
            {
                newRepo.LoadProfiles("profiles.json");
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Ошибка загрузки {ProfilesFile}: {ex.Message}", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            var groups = TryLoadOldRepo();

            if (groups != null)
            {
                newRepo.SaveProfiles(ProfilesFile, _knownConnections._knownConnectionProfiles);
                newRepo.Save(ConnectionsFile, groups);
            }
            else
            {
                try
                {
                    groups = newRepo.Load(ConnectionsFile);
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Ошибка загрузки {ConnectionsFile}: {ex.Message}", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }

            return(groups);
        }
Exemplo n.º 2
0
        private void SaveProject()
        {
            var groups = ConnectionGroupViewModels.Select(vm => vm.Source).ToList();

            var repoReader = new NewRepositoryReader(_knownConnections);

            repoReader.Save(ConnectionsFile, groups);
            repoReader.SaveProfiles(ProfilesFile, _knownConnections._knownConnectionProfiles);
        }