private void FileChanges_SelectionChanged(object sender, EventArgs e) { if (FileChanges.SelectedRows.Count == 0) return; if (FileChanges.SelectedRows[0].DataBoundItem is IGitItem) { IGitItem revision = (IGitItem)FileChanges.SelectedRows[0].DataBoundItem; View.Text = GitCommands.GitCommands.GetFileText(revision.Guid); View.Refresh(); } if (FileChanges.SelectedRows.Count == 2) { if (FileChanges.SelectedRows[0].DataBoundItem is IGitItem) if (FileChanges.SelectedRows[1].DataBoundItem is IGitItem) { IGitItem revision1 = (IGitItem)FileChanges.SelectedRows[0].DataBoundItem; IGitItem revision2 = (IGitItem)FileChanges.SelectedRows[1].DataBoundItem; Diff diff = new Diff(new DiffDto(revision1.Guid, revision2.Guid)); diff.Execute(); EditorOptions.SetSyntax(Diff, FileName); Diff.Text = diff.Dto.Result; Diff.Refresh(); } } else { Diff.Text = "You need to select 2 files to view diff."; Diff.Refresh(); } }
private void FileChanges_SelectionChanged(object sender, EventArgs e) { if (FileChanges.SelectedRows.Count == 0) return; if (FileChanges.SelectedRows[0].DataBoundItem is IGitItem) { GitItem revision = (GitItem)FileChanges.SelectedRows[0].DataBoundItem; if (tabControl1.SelectedTab == Blame) { BlameGrid.DataSource = GitCommands.GitCommands.Blame(FileName, revision.CommitGuid); } if (tabControl1.SelectedTab == ViewTab) { View.Text = GitCommands.GitCommands.GetFileText(revision.Guid); View.Refresh(); } } if (FileChanges.SelectedRows.Count == 2) { if (FileChanges.SelectedRows[0].DataBoundItem is GitItem) if (FileChanges.SelectedRows[1].DataBoundItem is GitItem) { GitItem revision1 = (GitItem)FileChanges.SelectedRows[0].DataBoundItem; GitItem revision2 = (GitItem)FileChanges.SelectedRows[1].DataBoundItem; if (tabControl1.SelectedTab == DiffTab) { Diff diff = new Diff(new DiffDto(revision1.CommitGuid, revision2.CommitGuid, revision1.FileName)); diff.Execute(); EditorOptions.SetSyntax(Diff, FileName); Diff.Text = diff.Dto.Result; Diff.Refresh(); } } } else if (FileChanges.SelectedRows.Count == 1) { if (FileChanges.SelectedRows[0].DataBoundItem is GitItem) { GitItem revision1 = (GitItem)FileChanges.SelectedRows[0].DataBoundItem; if (tabControl1.SelectedTab == DiffTab) { Diff diff = new Diff(new DiffDto(revision1.CommitGuid, revision1.CommitGuid + "^", FileName)); diff.Execute(); EditorOptions.SetSyntax(Diff, FileName); Diff.Text = diff.Dto.Result; Diff.Refresh(); } } } else { Diff.Text = "You need to select 2 files to view diff."; Diff.Refresh(); } }
private void FileChanges_SelectionChanged(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; List<GitRevision> selectedRows = FileChanges.GetRevisions(); if (selectedRows.Count == 0) return; IGitItem revision = selectedRows[0]; string fileName = revision.Name; if (string.IsNullOrEmpty(fileName)) fileName = FileName; this.Text = "File History (" + fileName + ")"; if (tabControl1.SelectedTab == Blame) { //BlameGrid.DataSource = GitCommands.GitCommands.Blame(FileName, revision.CommitGuid); int scrollpos = BlameFile.ActiveTextAreaControl.VScrollBar.Value; FillBlameTab(revision.Guid, fileName); BlameFile.ActiveTextAreaControl.VScrollBar.Value = scrollpos; } if (tabControl1.SelectedTab == ViewTab) { int scrollpos =View.ScrollPos; View.ViewGitItemRevision(fileName, revision.Guid); View.ScrollPos = scrollpos; } if (selectedRows.Count == 2) { { IGitItem revision1 = selectedRows[0]; IGitItem revision2 = selectedRows[1]; if (tabControl1.SelectedTab == DiffTab) { Diff diff = new Diff(new DiffDto(revision1.Guid, revision2.Guid, fileName)); diff.Execute(); ///EditorOptions.SetSyntax(Diff, FileName); Diff.ViewPatch(diff.Dto.Result); } } } else if (selectedRows.Count == 1) { IGitItem revision1 = selectedRows[0]; if (tabControl1.SelectedTab == DiffTab) { Diff diff = new Diff(new DiffDto(revision1.Guid + "^", revision1.Guid, fileName)); diff.Execute(); Diff.ViewPatch(diff.Dto.Result); } } else { Diff.ViewPatch("You need to select 2 files to view diff."); } }
private void FileChanges_SelectionChanged(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; if (FileChanges.SelectedRows.Count == 0) return; if (FileChanges.SelectedRows[0].DataBoundItem is IGitItem) { GitItem revision = (GitItem)FileChanges.SelectedRows[0].DataBoundItem; if (tabControl1.SelectedTab == Blame) { BlameGrid.DataSource = GitCommands.GitCommands.Blame(FileName, revision.CommitGuid); } if (tabControl1.SelectedTab == ViewTab) { int scrollpos =View.ScrollPos; View.ViewGitItem(FileName, revision.Guid); View.ScrollPos = scrollpos; } } if (FileChanges.SelectedRows.Count == 2) { if (FileChanges.SelectedRows[0].DataBoundItem is GitItem) if (FileChanges.SelectedRows[1].DataBoundItem is GitItem) { GitItem revision1 = (GitItem)FileChanges.SelectedRows[0].DataBoundItem; GitItem revision2 = (GitItem)FileChanges.SelectedRows[1].DataBoundItem; if (tabControl1.SelectedTab == DiffTab) { Diff diff = new Diff(new DiffDto(revision1.CommitGuid, revision2.CommitGuid, revision1.FileName)); diff.Execute(); ///EditorOptions.SetSyntax(Diff, FileName); Diff.ViewPatch(diff.Dto.Result); } } } else if (FileChanges.SelectedRows.Count == 1) { if (FileChanges.SelectedRows[0].DataBoundItem is GitItem) { GitItem revision1 = (GitItem)FileChanges.SelectedRows[0].DataBoundItem; if (tabControl1.SelectedTab == DiffTab) { Diff diff = new Diff(new DiffDto(revision1.CommitGuid + "^", revision1.CommitGuid, FileName)); diff.Execute(); Diff.ViewPatch(diff.Dto.Result); } } } else { Diff.ViewPatch("You need to select 2 files to view diff."); } }