Example #1
0
        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);
        }
Example #2
0
 private void DoReset()
 {
     Left  = null;
     Left  = LeftSelection.First();
     Right = null;
     Right = RightSelection.First();
 }
Example #3
0
 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);
 }
Example #4
0
        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);
        }
Example #5
0
        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);
        }