/// <summary>
        /// Open the given repo in the 'HistoryPage' control and its sub-system of controls.
        /// </summary>
        private void OpenLocalRepo()
        {
            if (string.IsNullOrWhiteSpace(_repoFolder))
            {
                return;
            }

            SuspendLayout();
            if (_historyPage != null)
            {
                _historyPage.RevisionSelectionChanged -= HistoryPageRevisionSelectionChanged;
                Controls.Remove(_historyPage);
                _historyPage.Dispose();
                _historyPage = null;
            }
            if (_chorusSystem != null)
            {
                _chorusSystem.Dispose();
                _chorusSystem = null;
            }

            var          repoType = GetRepoType();
            ChorusSystem newChorusSystem;

            switch (repoType)
            {
            case RepoType.None:
                return;

            case RepoType.NotSupported:
                MessageBox.Show(this, "The selected repository is not supported.", "Unsupported Repository Type",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;

            case RepoType.LIFT:
                newChorusSystem = Utilities.InitializeChorusSystem(_repoFolder, Environment.UserName, LiftFolder.AddLiftFileInfoToFolderConfiguration);
                break;

            case RepoType.FLEx:
                newChorusSystem = Utilities.InitializeChorusSystem(_repoFolder, Environment.UserName, FlexFolderSystem.ConfigureChorusProjectFolder);
                break;

            default:
                MessageBox.Show(this, "The selected repository is recognized, but not yet supported.", "Unsupported Repository Type",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            _chorusSystem = newChorusSystem;

            // Set up some new columns in the main control of the history page.
            // This makes it easy for the user to know the selected revision's branch and simple rev id.
            var historyPageOptions  = new HistoryPageOptions();
            var revisionListOptions = historyPageOptions.RevisionListOptions;
            // Not enabled in Chorus. revisionListOptions.ShowRevisionChoiceControls = true;
            var branchColumnDefinition = new HistoryColumnDefinition
            {
                ColumnLabel    = "Branch",
                StringSupplier = BranchName
            };
            // This is available as a tool tip of the icon cell, but show it here, anyway.
            var revisionIdColumnDefinition = new HistoryColumnDefinition
            {
                ColumnLabel    = "Revision Id",
                StringSupplier = RevisionId
            };

            revisionListOptions.ExtraColumns = new List <HistoryColumnDefinition>
            {
                branchColumnDefinition,
                revisionIdColumnDefinition
            };
            _historyPage = _chorusSystem.WinForms.CreateHistoryPage(historyPageOptions);
            _historyPage.RevisionSelectionChanged += HistoryPageRevisionSelectionChanged;
            Controls.Add(_historyPage);
            _historyPage.Dock = DockStyle.Fill;

            ResumeLayout(true);
        }
Exemple #2
0
 /// <summary>
 /// Get a UI control which shows all the revisions in the repository, and
 /// lets the user select one to see what changed.
 /// </summary>
 public HistoryPage CreateHistoryPage(HistoryPageOptions options)
 {
     return(_container.Resolve <HistoryPage.Factory>()(options));
 }