public StoreHistoryViewModel(Store store, IEnumerable<PrefixConfiguration> prefixes) : base(store)
 {
     CommitPoints = new ObservableCollection<CommitPointViewModel>(store.GetCommitPoints(0, 20));
     HasMoreCommitPoints = CommitPoints.Count == 20;
     HistoricalQueryViewModel = new SparqlQueryViewModel(store, prefixes);
     ExecuteCommand = HistoricalQueryViewModel.ExecuteCommand;
     RefreshCommand = new RelayCommand(Refresh);
     RevertCommand = new RelayCommand(Revert);
     MoreCommitPointsCommand = new RelayCommand(MoreCommitPoints);
 }
Beispiel #2
0
        public void MoreCommitPoints()
        {
            var lastCommitPoint = CommitPoints[CommitPoints.Count - 1];
            int foundCount      = 0;

            if (DateTimeFilterFrom == null && DateTimeFilterTo == null)
            {
                foreach (var commitPoint in Store.GetCommitPoints(CommitPoints.Count, 100))
                {
                    foundCount++;
                    if (commitPoint.CommitTime < lastCommitPoint.CommitTime)
                    {
                        CommitPoints.Add(commitPoint);
                    }
                }
                if (CommitPoints[CommitPoints.Count - 1].Id == lastCommitPoint.Id)
                {
                    // We didn't add any new commit points. This indicates that a lot of new commit points have been added to the store recently so we should do a full update
                    Refresh();
                }
                else
                {
                    HasMoreCommitPoints = (foundCount == 100);
                }
            }
            else
            {
                DateTime latest, earliest;
                GetDateTimeFilter(out latest, out earliest);
                var initialCount = CommitPoints.Count;
                foreach (var commitPoint in Store.GetCommitPoints(latest, earliest, CommitPoints.Count, 100))
                {
                    foundCount++;
                    CommitPoints.Add(commitPoint);
                }
                HasMoreCommitPoints = (CommitPoints.Count - initialCount) == 100;
            }
        }
Beispiel #3
0
 public void Refresh()
 {
     if (DateTimeFilterFrom == null && DateTimeFilterTo == null)
     {
         var targetCount = Math.Max(100, CommitPoints.Count);
         CommitPoints.Clear();
         foreach (var commitPoint in Store.GetCommitPoints(0, targetCount))
         {
             CommitPoints.Add(commitPoint);
         }
         HasMoreCommitPoints = CommitPoints.Count == targetCount;
     }
     else
     {
         DateTime latest, earliest;
         GetDateTimeFilter(out latest, out earliest);
         CommitPoints.Clear();
         foreach (var commitPoint in Store.GetCommitPoints(latest, earliest, 0, 100))
         {
             CommitPoints.Add(commitPoint);
         }
         HasMoreCommitPoints = CommitPoints.Count == 100;
     }
 }
Beispiel #4
0
 public StoreHistoryViewModel(Store store, IEnumerable <PrefixConfiguration> prefixes) : base(store)
 {
     CommitPoints             = new ObservableCollection <CommitPointViewModel>(store.GetCommitPoints(0, 20));
     HasMoreCommitPoints      = CommitPoints.Count == 20;
     HistoricalQueryViewModel = new SparqlQueryViewModel(store, prefixes);
     ExecuteCommand           = HistoricalQueryViewModel.ExecuteCommand;
     RefreshCommand           = new RelayCommand(Refresh);
     RevertCommand            = new RelayCommand(Revert);
     MoreCommitPointsCommand  = new RelayCommand(MoreCommitPoints);
 }