コード例 #1
0
ファイル: ActivityTracker.cs プロジェクト: tobeks/herring
        private static void MaybeCommitSummary(DateTime currTimePoint)
        {
            if (currTimePoint > activeTimePoint)
            {
                // Separate snapshots belonging to the current and the next interval
                List <ActivitySnapshot> currSnapshots = new List <ActivitySnapshot>();
                List <ActivitySnapshot> nextSnapshots = new List <ActivitySnapshot>();
                SplitSnapshots(activeSnapshots, activeTimePoint, currSnapshots, nextSnapshots);

                // Summarize the previous interval
                ActivitySummary summary = GetActivitySummary(currSnapshots, activeTimePoint);

                if (summary.Entries.Count >= 1)
                {
                    Persistence.Store(summary);
                    currentLog.Add(summary);
                    if (currentLog == selectedLog)
                    {
                        OnCurrentLogExtended(summary);
                    }
                }

                // Consider the end of the day
                bool dateChanged = (currTimePoint.Date > activeTimePoint.Date);
                if (dateChanged)
                {
                    Persistence.Close();

                    currentLog.Clear();
                    if (currentLog == selectedLog)
                    {
                        OnCurrentLogChanged(currTimePoint.Date);
                    }
                }

                // Start a new interval
                activeSnapshots = nextSnapshots;
                activeTimePoint = currTimePoint;
            }
        }
コード例 #2
0
 public void Clear()
 {
     Persistence.Close();
     Activities.Clear();
 }