Exemplo n.º 1
0
        internal void UpdateReviewedRevisions(HashSet <string> revisions, RevisionType affectedType)
        {
            RevisionBrowserModel model = getModel();

            if (model.Data != null && model.Data.BaseSha != null && model.Data.Revisions != null)
            {
                RevisionBrowserModelData newData = new RevisionBrowserModelData(
                    model.Data.BaseSha,
                    model.Data.Revisions[RevisionType.Commit].Cast <Commit>(),
                    model.Data.Revisions[RevisionType.Version].Cast <GitLabSharp.Entities.Version>(),
                    revisions);
                SetData(newData, affectedType);
            }
        }
Exemplo n.º 2
0
        internal void SetData(RevisionBrowserModelData data, RevisionType defaultRevisionType)
        {
            // We want to re-expand all previously expanded types if they are collapsed by upgrading the Model
            Dictionary <RevisionType, bool> oldExpandedState = new Dictionary <RevisionType, bool>();

            foreach (RevisionType type in new RevisionType[] { RevisionType.Commit, RevisionType.Version })
            {
                oldExpandedState[type] = getRevisionTypeNode(type).IsExpanded;
            }

            getModel().Data = data;
            autoSelectRevision(getRevisionTypeNode(defaultRevisionType));

            foreach (KeyValuePair <RevisionType, bool> kv in oldExpandedState.Where(x => x.Value))
            {
                getRevisionTypeNode(kv.Key).Expand();
            }

            if (_treeView.SelectedNode != null)
            {
                _treeView.EnsureVisible(_treeView.SelectedNode);
            }
        }