Example #1
0
        protected override void LoadMoreViewFrom(Section section)
        {
            base.LoadMoreViewFrom(section);

            _toolbar.TreeModeButton.Checked = _treeMode = section.GetValue <bool>("TreeMode", true);
            var stagedListSection = section.TryGetSection("StagedList");

            if (stagedListSection != null)
            {
                _lstStaged.LoadViewFrom(stagedListSection);
            }
            var unstagedListSection = section.TryGetSection("UnstagedList");

            if (unstagedListSection != null)
            {
                _lstUnstaged.LoadViewFrom(unstagedListSection);
            }
        }
Example #2
0
        protected override void LoadMoreViewFrom(Section section)
        {
            base.LoadMoreViewFrom(section);
            var listSection = section.TryGetSection("ConfigParameterList");

            if (listSection != null)
            {
                _lstConfig.LoadViewFrom(listSection);
            }
        }
Example #3
0
        protected override void LoadMoreViewFrom(Section section)
        {
            base.LoadMoreViewFrom(section);
            var listNode = section.TryGetSection("ReferenceList");

            if (listNode != null)
            {
                _lstReferences.LoadViewFrom(listNode);
            }
        }
Example #4
0
        protected override void LoadRepositoryConfig(Section section)
        {
            base.LoadRepositoryConfig(section);
            var logOptionsNode = section.TryGetSection("LogOptions");

            if (logOptionsNode != null)
            {
                LogOptions.LoadFrom(logOptionsNode);
            }
        }
Example #5
0
        protected override void LoadMoreViewFrom(Section section)
        {
            base.LoadMoreViewFrom(section);
            var listNode = section.TryGetSection("TreeList");

            if (listNode != null)
            {
                _treeContent.LoadViewFrom(listNode);
            }
        }
Example #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ViewLayout"/> class.
        /// </summary>
        /// <param name="section">The section.</param>
        public ViewLayout(Section section)
        {
            Verify.Argument.IsNotNull(section, nameof(section));

            _root = ToLayout(section.GetSection("Root"));

            var sides = section.TryGetSection("Sides");

            if (sides != null)
            {
                var left = sides.TryGetSection("Left");
                if (left != null)
                {
                    _left = new SideEntry(AnchorStyles.Left, left);
                }
                var top = sides.TryGetSection("Top");
                if (top != null)
                {
                    _top = new SideEntry(AnchorStyles.Top, top);
                }
                var right = sides.TryGetSection("Right");
                if (right != null)
                {
                    _right = new SideEntry(AnchorStyles.Right, right);
                }
                var bottom = sides.TryGetSection("Bottom");
                if (bottom != null)
                {
                    _bottom = new SideEntry(AnchorStyles.Bottom, bottom);
                }
            }
            var floats = section.TryGetSection("Floats");

            if (floats != null)
            {
                foreach (var f in floats.Sections)
                {
                    _floats.Add(new FloatEntry(f));
                }
            }
        }
Example #7
0
        public static void LoadFrom(Section section)
        {
            Verify.Argument.IsNotNull(section, "section");

            var appearanceNode = section.TryGetSection("Appearance");

            if (appearanceNode != null)
            {
                var textRenderer = appearanceNode.TryGetParameter("TextRenderer");
                if (textRenderer != null)
                {
                    switch (textRenderer.Value as string)
                    {
                    case "GDI":
                        GitterApplication.TextRenderer = GitterApplication.GdiTextRenderer;
                        break;

                    case "GDI+":
                        GitterApplication.TextRenderer = GitterApplication.GdiPlusTextRenderer;
                        break;
                    }
                }
            }
            var servicesNode = section.TryGetSection("Services");

            if (servicesNode != null)
            {
                var spellingSection = servicesNode.TryGetSection("Spelling");
                if (spellingSection != null)
                {
                    SpellingService.LoadFrom(spellingSection);
                }
            }
            var featuresSection = section.TryGetSection("IntegrationFeatures");

            if (featuresSection != null)
            {
                GitterApplication.IntegrationFeatures.LoadFrom(featuresSection);
            }
        }
Example #8
0
        public void LoadFrom(Section section)
        {
            Verify.Argument.IsNotNull(section, "section");

            var localRepositories = section.TryGetSection("LocalRepositories");
            if(localRepositories != null)
            {
                LoadGroupContent(_local, localRepositories);
            }
            var recentRepositories = section.TryGetSection("RecentRepositories");
            if(recentRepositories != null)
            {
                _recent.Clear();
                foreach(var repositorySection in recentRepositories.Sections)
                {
                    var repository = TryLoadRepositoryFrom(repositorySection);
                    if(repository != null)
                    {
                        _recent.Add(repository);
                    }
                }
            }
        }
Example #9
0
 private static SelectableFont TryLoadFont(Section section, string id, string name, Func <Font> defaultFont)
 {
     section = section.TryGetSection(id);
     if (section != null)
     {
         SelectableFont font;
         try
         {
             font = new SelectableFont(id, name, section);
         }
         catch
         {
             font = new SelectableFont(id, name, defaultFont());
         }
         return(font);
     }
     else
     {
         return(new SelectableFont(id, name, defaultFont()));
     }
 }
Example #10
0
        protected override void LoadMoreViewFrom(Section section)
        {
            base.LoadMoreViewFrom(section);
            var listNode = section.TryGetSection("RepositoryList");

            if (listNode != null)
            {
                _lstLocalRepositories.LoadViewFrom(listNode);
                _lstLocalRepositories.BeginUpdate();
                _lstLocalRepositories.Items.Clear();
                _lstLocalRepositories.LoadViewFrom(listNode);
                var itemsNode = listNode.TryGetSection("Items");
                if (itemsNode != null)
                {
                    foreach (var s in itemsNode.Sections)
                    {
                        var link = new RepositoryLink(s);
                        var item = new RepositoryListItem(link);
                        _lstLocalRepositories.Items.Add(item);
                    }
                }
                _lstLocalRepositories.EndUpdate();
            }
        }
Example #11
0
 protected override void LoadMoreViewFrom(Section section)
 {
     base.LoadMoreViewFrom(section);
     var listNode = section.TryGetSection("ReferenceList");
     if(listNode != null)
     {
         _lstReferences.LoadViewFrom(listNode);
     }
 }
Example #12
0
 protected override void LoadMoreViewFrom(Section section)
 {
     base.LoadMoreViewFrom(section);
     var listNode = section.TryGetSection("RepositoryList");
     if(listNode != null)
     {
         _lstLocalRepositories.LoadViewFrom(listNode);
         _lstLocalRepositories.BeginUpdate();
         _lstLocalRepositories.Items.Clear();
         _lstLocalRepositories.LoadViewFrom(listNode);
         var itemsNode = listNode.TryGetSection("Items");
         if(itemsNode != null)
         {
             foreach(var s in itemsNode.Sections)
             {
                 var link = new RepositoryLink(s);
                 var item = new RepositoryListItem(link);
                 _lstLocalRepositories.Items.Add(item);
             }
         }
         _lstLocalRepositories.EndUpdate();
     }
 }
Example #13
0
        protected override void LoadMoreViewFrom(Section section)
        {
            base.LoadMoreViewFrom(section);

            _toolbar.TreeModeButton.Checked = _treeMode = section.GetValue<bool>("TreeMode", true);
            var stagedListSection = section.TryGetSection("StagedList");
            if(stagedListSection != null)
            {
                _lstStaged.LoadViewFrom(stagedListSection);
            }
            var unstagedListSection = section.TryGetSection("UnstagedList");
            if(unstagedListSection != null)
            {
                _lstUnstaged.LoadViewFrom(unstagedListSection);
            }
        }
Example #14
0
 protected override void LoadRepositoryConfig(Section section)
 {
     if(Guid == Guids.ContextualDiffViewGuid)
     {
         var node = section.TryGetSection("ContextualDiffOptions");
         if(node != null)
         {
             _options.Context = node.GetValue<int>("Context", _options.Context);
             _options.IgnoreWhitespace = node.GetValue<bool>("IgnoreWhitespace", _options.IgnoreWhitespace);
             _options.UsePatienceAlgorithm = node.GetValue<bool>("UsePatienceAlgorithm", _options.UsePatienceAlgorithm);
             switch(node.GetValue<string>("ViewMode", string.Empty))
             {
                 case "Split":
                     ViewMode = DiffViewMode.Split;
                     break;
                 case "Single":
                 default:
                     ViewMode = DiffViewMode.Single;
                     break;
             }
         }
     }
     base.LoadRepositoryConfig(section);
 }
Example #15
0
        public void LoadViewFrom(Section section)
        {
            Verify.Argument.IsNotNull(section, "section");

            BeginUpdate();
            var columnsSection = section.TryGetSection("Columns");
            if(columnsSection != null)
            {
                var dict = new Dictionary<string, CustomListBoxColumn>(_columns.Count);
                foreach(var c in _columns)
                {
                    dict.Add(c.IdentificationString, c);
                }
                _columns.Clear();

                foreach(var child in columnsSection.Sections)
                {
                    var name = child.Name;
                    CustomListBoxColumn column;
                    if(dict.TryGetValue(name, out column))
                    {
                        column.LoadFrom(child);
                        _columns.Add(column);
                        dict.Remove(name);
                    }
                }
                foreach(var column in dict.Values)
                {
                    _columns.Add(column);
                }
            }
            LoadMoreViewFrom(section);
            EndUpdate();
        }
Example #16
0
        public static void LoadFrom(Section section)
        {
            Verify.Argument.IsNotNull(section, "section");

            var appearanceNode = section.TryGetSection("Appearance");
            if(appearanceNode != null)
            {
                var textRenderer = appearanceNode.TryGetParameter("TextRenderer");
                if(textRenderer != null)
                {
                    switch(textRenderer.Value as string)
                    {
                        case "GDI":
                            GitterApplication.TextRenderer = GitterApplication.GdiTextRenderer;
                            break;
                        case "GDI+":
                            GitterApplication.TextRenderer = GitterApplication.GdiPlusTextRenderer;
                            break;
                    }
                }
            }
            var servicesNode = section.TryGetSection("Services");
            if(servicesNode != null)
            {
                var spellingSection = servicesNode.TryGetSection("Spelling");
                if(spellingSection != null)
                {
                    SpellingService.LoadFrom(spellingSection);
                }
            }
            var featuresSection = section.TryGetSection("IntegrationFeatures");
            if(featuresSection != null)
            {
                GitterApplication.IntegrationFeatures.LoadFrom(featuresSection);
            }
        }
Example #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ViewLayout"/> class.
        /// </summary>
        /// <param name="section">The section.</param>
        public ViewLayout(Section section)
        {
            Verify.Argument.IsNotNull(section, "section");

            _root = ToLayout(section.GetSection("Root"));

            var sides = section.TryGetSection("Sides");
            if(sides != null)
            {
                var left = sides.TryGetSection("Left");
                if(left != null)
                {
                    _left = new SideEntry(AnchorStyles.Left, left);
                }
                var top = sides.TryGetSection("Top");
                if(top != null)
                {
                    _top = new SideEntry(AnchorStyles.Top, top);
                }
                var right = sides.TryGetSection("Right");
                if(right != null)
                {
                    _right = new SideEntry(AnchorStyles.Right, right);
                }
                var bottom = sides.TryGetSection("Bottom");
                if(bottom != null)
                {
                    _bottom = new SideEntry(AnchorStyles.Bottom, bottom);
                }
            }
            var floats = section.TryGetSection("Floats");
            if(floats != null)
            {
                foreach(var f in floats.Sections)
                {
                    _floats.Add(new FloatEntry(f));
                }
            }
        }
Example #18
0
 protected override void LoadMoreViewFrom(Section section)
 {
     base.LoadMoreViewFrom(section);
     var listSection = section.TryGetSection("ConfigParameterList");
     if(listSection != null)
     {
         _lstConfig.LoadViewFrom(listSection);
     }
 }
Example #19
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);
                    }
                }
            }
        }
Example #20
0
 protected override void LoadMoreViewFrom(Section section)
 {
     base.LoadMoreViewFrom(section);
     var layoutNode = section.TryGetSection("Layout");
     if(layoutNode != null)
     {
         //_toolbar.ShowDiffButton.Checked = ShowDetails = layoutNode.GetValue("ShowDetails", ShowDetails);
     }
     var listNode = section.TryGetSection("RevisionList");
     if(listNode != null)
     {
         RevisionListBox.LoadViewFrom(listNode);
     }
 }
Example #21
0
        public bool LoadFor(IWorkingEnvironment environment, Section section)
        {
            Verify.Argument.IsNotNull(environment, nameof(environment));

            if (section != null)
            {
                var providerName = section.GetValue <string>("AccessorProvider", string.Empty);
                if (!string.IsNullOrWhiteSpace(providerName))
                {
                    ActiveGitAccessorProvider = GitAccessorProviders.FirstOrDefault(
                        prov => prov.Name == providerName);
                }
                if (ActiveGitAccessorProvider == null)
                {
                    ActiveGitAccessorProvider = GitAccessorProviders.First();
                }
                var gitAccessorSection = section.TryGetSection(ActiveGitAccessorProvider.Name);
                if (gitAccessorSection != null)
                {
                    GitAccessor.LoadFrom(gitAccessorSection);
                }
            }
            else
            {
                ActiveGitAccessorProvider = GitAccessorProviders.First();
            }
            Version gitVersion;

            try
            {
                gitVersion = _gitAccessor.GitVersion;
            }
            catch (Exception exc) when(!exc.IsCritical())
            {
                gitVersion = null;
            }
            if (gitVersion == null || gitVersion < MinimumRequiredGitVersion)
            {
                using (var dlg = new VersionCheckDialog(environment, this, MinimumRequiredGitVersion, gitVersion))
                {
                    dlg.Run(environment.MainForm);
                    gitVersion = dlg.InstalledVersion;
                    if (gitVersion == null || gitVersion < _minVersion)
                    {
                        return(false);
                    }
                }
            }
            GlobalOptions.RegisterPropertyPageFactory(
                new PropertyPageFactory(
                    GitOptionsPage.Guid,
                    Resources.StrGit,
                    null,
                    PropertyPageFactory.RootGroupGuid,
                    env => new GitOptionsPage(env)));
            GlobalOptions.RegisterPropertyPageFactory(
                new PropertyPageFactory(
                    ConfigurationPage.Guid,
                    Resources.StrConfig,
                    null,
                    GitOptionsPage.Guid,
                    env => new ConfigurationPage(env)));
            _environment   = environment;
            _configSection = section;
            return(true);
        }
Example #22
0
        public bool LoadFor(IWorkingEnvironment environment, Section section)
        {
            Verify.Argument.IsNotNull(environment, "environment");

            if(section != null)
            {
                var providerName = section.GetValue<string>("AccessorProvider", string.Empty);
                if(!string.IsNullOrWhiteSpace(providerName))
                {
                    ActiveGitAccessorProvider = GitAccessorProviders.FirstOrDefault(
                        prov => prov.Name == providerName);
                }
                if(ActiveGitAccessorProvider == null)
                {
                    ActiveGitAccessorProvider = GitAccessorProviders.First();
                }
                var gitAccessorSection = section.TryGetSection(ActiveGitAccessorProvider.Name);
                if(gitAccessorSection != null)
                {
                    GitAccessor.LoadFrom(gitAccessorSection);
                }
            }
            else
            {
                ActiveGitAccessorProvider = GitAccessorProviders.First();
            }
            Version gitVersion;
            try
            {
                gitVersion = _gitAccessor.GitVersion;
            }
            catch(Exception exc)
            {
                if(exc.IsCritical())
                {
                    throw;
                }
                gitVersion = null;
            }
            if(gitVersion == null || gitVersion < MinimumRequiredGitVersion)
            {
                using(var dlg = new VersionCheckDialog(environment, this, MinimumRequiredGitVersion, gitVersion))
                {
                    dlg.Run(environment.MainForm);
                    gitVersion = dlg.InstalledVersion;
                    if(gitVersion == null || gitVersion < _minVersion)
                    {
                        return false;
                    }
                }
            }
            GlobalOptions.RegisterPropertyPageFactory(
                new PropertyPageFactory(
                    GitOptionsPage.Guid,
                    Resources.StrGit,
                    null,
                    PropertyPageFactory.RootGroupGuid,
                    env => new GitOptionsPage(env)));
            GlobalOptions.RegisterPropertyPageFactory(
                new PropertyPageFactory(
                    ConfigurationPage.Guid,
                    Resources.StrConfig,
                    null,
                    GitOptionsPage.Guid,
                    env => new ConfigurationPage(env)));
            _environment = environment;
            _configSection = section;
            return true;
        }
Example #23
0
 protected override void LoadRepositoryConfig(Section section)
 {
     base.LoadRepositoryConfig(section);
     var logOptionsNode = section.TryGetSection("LogOptions");
     if(logOptionsNode != null)
     {
         LogOptions.LoadFrom(logOptionsNode);
     }
 }