private void DoSaveMerge() { file.SaveResult(ResultDocument.Text); var left = Left; var right = Right; if (left != _result) { _sourceFiles.Remove(left); } if (right != _result) { _sourceFiles.Remove(right); } if (file.Resolved) { Left = Right = null; } else { LeftSelection.Reset(); Left = _result; Right = RightSelection.First(); } FileResolved?.Invoke(this, EventArgs.Empty); }
private void DoReset() { Left = null; Left = LeftSelection.First(); Right = null; Right = RightSelection.First(); }
public void Remove(ModFile toRemove) { _sourceFiles.Remove(_sourceFiles.FirstOrDefault(f => f.Source == toRemove)); if (file.Resolved) { Left = Right = null; } else { LeftSelection.Reset(); Left = LeftSelection.First(); Right = RightSelection.First(); } FileResolved?.Invoke(this, EventArgs.Empty); }
public MergeProcess(MergedModFile fileToMerge) { file = fileToMerge; _result = new ModFileToMerge(file); _sourceFiles = new ObservableCollection <ModFileToMerge>(file.SourceFiles.Select(f => new ModFileToMerge(f))); _sourceFiles.Add(_result); _sourceFiles.CollectionChanged += SourceFilesCollectionChanged; LeftSelection = _sourceFiles.CreateDerivedCollection(f => f, f => f?.RawContents != null && f != Right); RightSelection = _sourceFiles.CreateDerivedCollection(f => f, f => f?.RawContents != null && f != Left); Left = LeftSelection.First(); Right = RightSelection.First(); PickLeft = ReactiveCommand.Create(DoPickLeft); PickRight = ReactiveCommand.Create(DoPickRight); SaveMerge = ReactiveCommand.Create(DoSaveMerge, _canSaveMerge); Reset = ReactiveCommand.Create(DoReset); }
private void DoPickLeft() { if (Right != _result) { _sourceFiles.Remove(Right); } else { file.SaveResult(null); } if (file.Resolved) { Left = Right = null; } else { RightSelection.Reset(); Right = RightSelection.First(); } FileResolved?.Invoke(this, EventArgs.Empty); }