private void ReloadPanes(FilePatcherViewModel f, ResultViewModel r, bool linesChanged) { bool newFile = File != f; if (newFile) { if (File != null) { File.PropertyChanged -= TrackPatchedLineChanges; } if (f != null) { f.PropertyChanged += TrackPatchedLineChanges; } } if (Result != r && Result?.EditingPatch != null) { throw new Exception("Leftover editing patch in result"); } File = f; Result = r; if (newFile || linesChanged) { filePanel.LoadDiff(File.BaseLines, File.PatchedLines); filePanel.SyntaxHighlighting = HighlightingManager.Instance.GetDefinitionByExtension(Path.GetExtension(File.BasePath)); } if (Result == null) { titleLabel.DataContext = File; patchTab.Visibility = Visibility.Hidden; filePanel.ClearRangeMarkers(); AddEditWarning(); SelectTab(fileTab); } else { titleLabel.DataContext = Result; patchTab.Visibility = Visibility.Visible; Result.ModifiedInEditor = false; Result.EditingPatch = Result.AppliedPatch; ReloadEditingPatch(); ReCalculateEditRange(); filePanel.ScrollToMarked(); } }
public ResultViewModel(FilePatcherViewModel file, Patcher.Result result, int origIndex) { File = file; Result = result; this.origIndex = origIndex; }
private void OnItemSelected(FilePatcherViewModel f) => ReloadPanes(f, null, false);
private void Select(FilePatcherViewModel f) => SelectItem(f);