public DiffMarginViewModel(DiffMargin margin, IWpfTextView textView, ITextDocumentFactoryService textDocumentFactoryService, IGitCommands gitCommands)
        {
            if (margin == null)
                throw new ArgumentNullException("margin");
            if (textView == null)
                throw new ArgumentNullException("textView");
            if (textDocumentFactoryService == null)
                throw new ArgumentNullException("textDocumentFactoryService");
            if (gitCommands == null)
                throw new ArgumentNullException("gitCommands");

            _margin = margin;
            _textView = textView;
            _gitCommands = gitCommands;
            _diffViewModels = new ObservableCollection<DiffViewModel>();
            _previousChangeCommand = new RelayCommand<DiffViewModel>(PreviousChange, PreviousChangeCanExecute);
            _nextChangeCommand = new RelayCommand<DiffViewModel>(NextChange, NextChangeCanExecute);

            _textView.LayoutChanged += OnLayoutChanged;
            _textView.ViewportHeightChanged += OnViewportHeightChanged;

            _parser = new DiffUpdateBackgroundParser(textView.TextBuffer, TaskScheduler.Default, textDocumentFactoryService, gitCommands);
            _parser.ParseComplete += HandleParseComplete;
            _parser.RequestParse(false);
        }
        public DiffMarginViewModel(DiffMargin margin, IWpfTextView textView, ITextDocumentFactoryService textDocumentFactoryService, IGitCommands gitCommands)
        {
            if (margin == null)
            {
                throw new ArgumentNullException("margin");
            }
            if (textView == null)
            {
                throw new ArgumentNullException("textView");
            }
            if (textDocumentFactoryService == null)
            {
                throw new ArgumentNullException("textDocumentFactoryService");
            }
            if (gitCommands == null)
            {
                throw new ArgumentNullException("gitCommands");
            }

            _margin                = margin;
            _textView              = textView;
            _gitCommands           = gitCommands;
            _diffViewModels        = new List <DiffViewModel>();
            _previousChangeCommand = new RelayCommand <DiffViewModel>(PreviousChange, PreviousChangeCanExecute);
            _nextChangeCommand     = new RelayCommand <DiffViewModel>(NextChange, NextChangeCanExecute);

            _textView.LayoutChanged += OnLayoutChanged;

            _parser = new DiffUpdateBackgroundParser(textView.TextBuffer, textView.TextDataModel.DocumentBuffer, TaskScheduler.Default, textDocumentFactoryService, gitCommands);
            _parser.ParseComplete += HandleParseComplete;
            _parser.RequestParse(false);
        }
Example #3
0
        public DiffViewModel(DiffMargin margin, HunkRangeInfo hunkRangeInfo, IWpfTextView textView)
        {
            _margin                 = margin;
            _hunkRangeInfo          = hunkRangeInfo;
            _textView               = textView;
            _margin.BrushesChanged += HandleBrushesChanged;

            _copyOldTextCommand = new RelayCommand(CopyOldText, CopyOldTextCanExecute);
            _showPopUpCommand   = new RelayCommand(ShowPopUp);
            _rollbackCommand    = new RelayCommand(Rollback, RollbackCanExecute);

            ShowPopup = false;

            SetDisplayProperties(false, null);

            DiffText = GetDiffText();

            IsDiffTextVisible = GetIsDiffTextVisible();
        }
        public DiffViewModel(DiffMargin margin, HunkRangeInfo hunkRangeInfo, IWpfTextView textView)
        {
            _margin = margin;
            _hunkRangeInfo = hunkRangeInfo;
            _textView = textView;
            _margin.BrushesChanged += HandleBrushesChanged;

            _copyOldTextCommand = new RelayCommand(CopyOldText, CopyOldTextCanExecute);
            _showPopUpCommand = new RelayCommand(ShowPopUp);
            _rollbackCommand = new RelayCommand(Rollback, RollbackCanExecute);

            ShowPopup = false;

            SetDisplayProperties(false, null);

            DiffText = GetDiffText();

            IsDiffTextVisible = GetIsDiffTextVisible();
        }