예제 #1
0
        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();
            }
        }
예제 #2
0
 public ResultViewModel(FilePatcherViewModel file, Patcher.Result result, int origIndex)
 {
     File           = file;
     Result         = result;
     this.origIndex = origIndex;
 }
예제 #3
0
 private void OnItemSelected(FilePatcherViewModel f) => ReloadPanes(f, null, false);
예제 #4
0
 private void Select(FilePatcherViewModel f) => SelectItem(f);