private void OnStatusFilterChanged(object sender, EventArgs e) { var changedFilesPanel = (ChangedFilesPanel)sender; var index = DiffViewer.Panels.IndexOf(changedFilesPanel) + 2; DiffViewer.BeginUpdate(); if (index < DiffViewer.Panels.Count) { DiffViewer.Panels.RemoveRange(index, DiffViewer.Panels.Count - index); } FlowPanelSeparator separator = null; for (int i = 0; i < _allDiffPanels.Count; ++i) { if ((_allDiffPanels[i].DiffFile.Status & changedFilesPanel.StatusFilter) != FileStatus.Unknown) { DiffViewer.Panels.Add(_allDiffPanels[i]); DiffViewer.Panels.Add(separator = new FlowPanelSeparator() { SeparatorStyle = FlowPanelSeparatorStyle.Simple }); } } if (separator != null) { separator.Height = 6; } DiffViewer.EndUpdate(); }
protected override void OnFetchFailed(Exception exception) { if (DiffViewer.IsDisposed) { return; } DiffViewer.BeginUpdate(); _progressPanel.Remove(); if (exception != null && !string.IsNullOrWhiteSpace(exception.Message)) { DiffViewer.Panels.Add(new FlowProgressPanel() { Message = exception.Message }); } DiffViewer.EndUpdate(); }
protected override Task <Diff> FetchDataAsync(IProgress <OperationProgress> progress, CancellationToken cancellationToken) { Verify.State.IsFalse(IsDisposed, "DiffBinding is disposed."); if (!DiffViewer.Created) { DiffViewer.CreateControl(); } _scrollPosAfterReload = DiffViewer.VScrollPos; DiffViewer.BeginUpdate(); DiffViewer.Panels.Clear(); DiffViewer.ScrollToTopLeft(); AddSourceSpecificPanels(); DiffViewer.Panels.Add(_progressPanel); DiffViewer.EndUpdate(); _allDiffPanels.Clear(); return(DiffSource.GetDiffAsync(DiffOptions, progress, cancellationToken)); }
protected override void OnFetchCompleted(Diff diff) { if (DiffViewer.IsDisposed) { return; } DiffViewer.BeginUpdate(); _allDiffPanels.Clear(); _progressPanel.Remove(); if (diff != null) { FlowPanelSeparator separator = null; var changedFilesPanel = new ChangedFilesPanel() { Diff = diff }; changedFilesPanel.StatusFilterChanged += OnStatusFilterChanged; DiffViewer.Panels.Add(changedFilesPanel); DiffViewer.Panels.Add(new FlowPanelSeparator() { SeparatorStyle = FlowPanelSeparatorStyle.Line }); foreach (var file in diff) { var fileDiffPanel = new FileDiffPanel(DiffSource.Repository, file, diff.Type); _allDiffPanels.Add(fileDiffPanel); DiffViewer.Panels.Add(fileDiffPanel); DiffViewer.Panels.Add(separator = new FlowPanelSeparator() { SeparatorStyle = FlowPanelSeparatorStyle.Simple }); } if (separator != null) { separator.Height = 6; } } DiffViewer.EndUpdate(); if (_scrollPosAfterReload != 0) { DiffViewer.BeginInvoke(new Action <int>(SetScrollPos), _scrollPosAfterReload); } }