Exemplo n.º 1
0
        public RepositoryGroupBinding(CustomListBoxItemsCollection items, RepositoryGroup group)
        {
            Verify.Argument.IsNotNull(items, "items");
            Verify.Argument.IsNotNull(group, "group");

            _items               = items;
            _group               = group;
            _groupsMapping       = new Dictionary<RepositoryGroup, RepositoryGroupListItem>();
            _repositoriesMapping = new Dictionary<RepositoryLink, RepositoryListItem>();

            foreach(var subGroup in group.Groups)
            {
                var item = new RepositoryGroupListItem(subGroup);
                _groupsMapping.Add(subGroup, item);
                items.Add(item);
            }
            foreach(var repository in group.Respositories)
            {
                var item = new RepositoryListItem(repository);
                _repositoriesMapping.Add(repository, item);
                items.Add(item);
            }

            group.Groups.Changed += OnGroupsChanged;
            group.Respositories.Changed += OnRepositoriesChanged;
        }
Exemplo n.º 2
0
        private static void LoadGroupContent(RepositoryGroup group, Section section)
        {
            Assert.IsNotNull(group);
            Assert.IsNotNull(section);

            group.Groups.Clear();
            group.Respositories.Clear();
            var groups = section.TryGetSection("Groups");

            if (groups != null)
            {
                foreach (var subGroupSection in groups.Sections)
                {
                    var subGroup = TryLoadGroupFrom(subGroupSection);
                    if (subGroup != null)
                    {
                        group.Groups.Add(subGroup);
                    }
                }
            }
            var repositories = section.TryGetSection("Repositories");

            if (repositories != null)
            {
                foreach (var repositorySection in repositories.Sections)
                {
                    var repository = TryLoadRepositoryFrom(repositorySection);
                    if (repository != null)
                    {
                        group.Respositories.Add(repository);
                    }
                }
            }
        }
Exemplo n.º 3
0
        private static void SaveGroupTo(RepositoryGroup group, Section section)
        {
            Assert.IsNotNull(group);
            Assert.IsNotNull(section);

            section.SetValue <string>("Name", group.Name);
            SaveGroupContentTo(group, section);
        }
Exemplo n.º 4
0
        private static RepositoryGroup TryLoadGroupFrom(Section section)
        {
            Assert.IsNotNull(section);

            var name = section.GetValue <string>("Name", string.Empty);

            if (string.IsNullOrWhiteSpace(name))
            {
                return(null);
            }
            var group = new RepositoryGroup(name.Trim());

            LoadGroupContent(group, section);
            return(group);
        }
Exemplo n.º 5
0
        private static void SaveGroupContentTo(RepositoryGroup group, Section section)
        {
            Assert.IsNotNull(group);
            Assert.IsNotNull(section);

            int id;
            var groupsSection = section.GetCreateEmptySection("Groups");

            id = 0;
            foreach (var subGroup in group.Groups)
            {
                var subGroupSection = groupsSection.CreateSection(string.Format(CultureInfo.InvariantCulture, "Group{0}", id++));
                SaveGroupTo(subGroup, subGroupSection);
            }
            var repositoriesSection = section.GetCreateEmptySection("Repositories");

            id = 0;
            foreach (var repository in group.Respositories)
            {
                var repositorySection = repositoriesSection.CreateSection(string.Format(CultureInfo.InvariantCulture, "Repository{0}", id++));
                SaveRepositoryTo(repository, repositorySection);
            }
        }
Exemplo n.º 6
0
 public RepositoryGroupEventArgs(RepositoryGroup repositoryGroup)
 {
     _repositoryGroup = repositoryGroup;
 }
Exemplo n.º 7
0
 public RepositoryManagerService(int maxRecentRepositories = 10)
 {
     _maxRecentREpositories = maxRecentRepositories;
     _recent = new RepositoryCollection();
     _local  = new RepositoryGroup("ROOT");
 }
Exemplo n.º 8
0
        private static RepositoryGroup TryLoadGroupFrom(Section section)
        {
            Assert.IsNotNull(section);

            var name = section.GetValue<string>("Name", string.Empty);
            if(string.IsNullOrWhiteSpace(name))
            {
                return null;
            }
            var group = new RepositoryGroup(name.Trim());
            LoadGroupContent(group, section);
            return group;
        }
Exemplo n.º 9
0
        private static void SaveGroupTo(RepositoryGroup group, Section section)
        {
            Assert.IsNotNull(group);
            Assert.IsNotNull(section);

            section.SetValue<string>("Name", group.Name);
            SaveGroupContentTo(group, section);
        }
Exemplo n.º 10
0
        private static void SaveGroupContentTo(RepositoryGroup group, Section section)
        {
            Assert.IsNotNull(group);
            Assert.IsNotNull(section);

            int id;
            var groupsSection = section.GetCreateEmptySection("Groups");
            id = 0;
            foreach(var subGroup in group.Groups)
            {
                var subGroupSection = groupsSection.CreateSection(string.Format(CultureInfo.InvariantCulture, "Group{0}", id++));
                SaveGroupTo(subGroup, subGroupSection);
            }
            var repositoriesSection = section.GetCreateEmptySection("Repositories");
            id = 0;
            foreach(var repository in group.Respositories)
            {
                var repositorySection = repositoriesSection.CreateSection(string.Format(CultureInfo.InvariantCulture, "Repository{0}", id++));
                SaveRepositoryTo(repository, repositorySection);
            }
        }
Exemplo n.º 11
0
        private static void LoadGroupContent(RepositoryGroup group, Section section)
        {
            Assert.IsNotNull(group);
            Assert.IsNotNull(section);

            group.Groups.Clear();
            group.Respositories.Clear();
            var groups = section.TryGetSection("Groups");
            if(groups != null)
            {
                foreach(var subGroupSection in groups.Sections)
                {
                    var subGroup = TryLoadGroupFrom(subGroupSection);
                    if(subGroup != null)
                    {
                        group.Groups.Add(subGroup);
                    }
                }
            }
            var repositories = section.TryGetSection("Repositories");
            if(repositories != null)
            {
                foreach(var repositorySection in repositories.Sections)
                {
                    var repository = TryLoadRepositoryFrom(repositorySection);
                    if(repository != null)
                    {
                        group.Respositories.Add(repository);
                    }
                }
            }
        }
Exemplo n.º 12
0
 public RepositoryGroupEventArgs(RepositoryGroup repositoryGroup)
 {
     RepositoryGroup = repositoryGroup;
 }
Exemplo n.º 13
0
 public RepositoryManagerService(int maxRecentRepositories = 10)
 {
     _maxRecentREpositories = maxRecentRepositories;
     _recent = new RepositoryCollection();
     _local  = new RepositoryGroup("ROOT");
 }