private void DetachFromRepository() { _repository.Head.PointerChanged -= OnHeadChanged; _repository.Status.Changed -= OnStatusUpdated; if (_currentBranch != null) { _currentBranch.PositionChanged -= OnCurrentBranchPositionChanged; } _currentBranch = null; _currentRevisionItem = null; _itemLookupTable = null; _currentIndex = -1; }
public void Clear() { if (_repository != null) { _repository.Head.PointerChanged -= OnHeadChanged; _repository.Status.Changed -= OnStatusUpdated; if (_currentBranch != null) { _currentBranch.PositionChanged -= OnCurrentBranchPositionChanged; _currentBranch = null; } _currentIndex = -1; _itemLookupTable = null; _revisionLog = null; _currentRevisionItem = null; _repository = null; Items.Clear(); } }
private void RefreshCurrentRevisionItem(Revision currentRevision) { int id = 0; var currentIndex = -1; RevisionListItem currentRevisionItem = null; foreach (CustomListBoxItem <Revision> item in Items) { if (item.DataContext == currentRevision && item.DataContext != null) { currentRevisionItem = (RevisionListItem)item; currentIndex = id; break; } ++id; } _currentIndex = currentIndex; _currentRevisionItem = currentRevisionItem; }
private void RelocateFakeItemsAfterCheckout(Repository repository) { var builder = GlobalBehavior.GraphBuilderFactory.CreateGraphBuilder <Revision>(); BeginUpdate(); RemoveFakeItems(builder); if (!repository.Head.IsEmpty) { var headRev = repository.Head.Revision; if (_currentRevisionItem != null) { _currentRevisionItem.InvalidateSafe(); } if (_currentBranch != null) { _currentBranch.PositionChanged -= OnCurrentBranchPositionChanged; } _currentBranch = _repository.Head.Pointer as Branch; if (_currentBranch != null) { _currentBranch.PositionChanged += OnCurrentBranchPositionChanged; } RefreshCurrentRevisionItem(headRev); ReinsertFakeItems(builder); } else { if (_currentRevisionItem != null) { _currentRevisionItem.InvalidateSafe(); } if (_currentBranch != null) { _currentBranch.PositionChanged -= OnCurrentBranchPositionChanged; } _currentBranch = null; _currentRevisionItem = null; _currentIndex = -1; ReinsertFakeItems(builder); } EndUpdate(); }
protected override void Dispose(bool disposing) { if (disposing) { if (_repository != null) { _repository.Head.PointerChanged -= OnHeadChanged; _repository.Status.Changed -= OnStatusUpdated; if (_currentBranch != null) { _currentBranch.PositionChanged -= OnCurrentBranchPositionChanged; _currentBranch = null; } _currentIndex = -1; _itemLookupTable = null; _revisionLog = null; _currentRevisionItem = null; _repository = null; Items.Clear(); } } base.Dispose(disposing); }