/// <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); pullFileFromRevisionRangeToolStripMenuItem.Enabled = true; }
private void ChangeSimulatedUser(string userName) { ClearOutInAnticipationOfSwitchingUsers(); var dir = Path.Combine(_testDirectory, userName); if (!Directory.Exists(dir)) { UnZipToDirectory(dir); } var shoppingListDir = Path.Combine(dir, "ShoppingList"); //note: if you don't have a user name, you can just let chorus try to figure one out. //Also note that this is not the same name as that used for any given network repository credentials; //Rather, it's the name which will show in the history, and besides Notes that this user makes. _chorusSystem = new ChorusSystem(shoppingListDir); _chorusSystem.DisplaySettings = new ChorusNotesDisplaySettings() { WritingSystemForNoteLabel = new TestWritingSystem("Algerian"), WritingSystemForNoteContent = new TestWritingSystem("Bradley Hand ITC") }; _chorusSystem.Init(userName); _chorusSystem.Repository.SetKnownRepositoryAddresses(new RepositoryAddress[] {_serverRepository}); _chorusSystem.ProjectFolderConfiguration.IncludePatterns.Add("*.xml"); _dataEditor = new DataEditor(_chorusSystem, Path.Combine(shoppingListDir, "shopping.xml")); _dataEditor.Dock = DockStyle.Fill; _frontPage.Controls.Add(_dataEditor); _notesBrowserControl = _chorusSystem.WinForms.CreateNotesBrowser(); _notesBrowserControl.Dock = DockStyle.Fill; _notesPage.Controls.Add(_notesBrowserControl); _historyControl = _chorusSystem.WinForms.CreateHistoryPage(); _historyControl.Dock = DockStyle.Fill; _historyPage.Controls.Add(_historyControl); }