/// <summary> /// You must pass the smallest timeframe the software will watch for. /// Eg.: If set to TEN_MINUTES, then one mouse movement or keypress in that timeframe /// will be considered an active time. /// DataPrecision is not implemented fully, only High precision works /// </summary> /// <param name="appName">If saving is enabled the resulting file will have this as prefix</param> /// <param name="resolution">The smallest timeframe the software will watch for</param> /// <param name="SavePreference">Dictates how usage data will be saved/stored</param> /// <param name="dataPrecision">Sets how fine grained the data will be</param> public Watcher(string appName, Resolution chosenResolution, SavePreference preference, DataPrecision dataPrecision) { ISaveService saveService = new SaveService(appName, preference, dataPrecision); IUsageKeeper keeper = CreateKeeper(ref saveService, dataPrecision, chosenResolution); IStorage store = new UsageStore(keeper); wService = new WatcherService(ref store, ref saveService); }
/// <summary> /// You must pass the smallest timeframe the software will watch for. /// Eg.: If set to TEN_MINUTES, then one mouse movement or keypress in that timeframe /// will be considered an active time. /// DataPrecision is not implemented fully, only High precision works /// </summary> /// <param name="appName">If saving is enabled the resulting file will have this as prefix</param> /// <param name="resolution">The smallest timeframe the software will watch for</param> /// <param name="savePreference">Dictates how usage data will be saved/stored</param> /// <param name="dataPrecision">Sets how fine grained the data will be</param> public Watcher(string appName, Resolution chosenResolution, SavePreference preference, DataPrecision dataPrecision) { ISaveService saveService = new SaveService(appName, preference, dataPrecision); IUsageToday today = (IUsageToday)CreateOrLoadKeeper(ref saveService, dataPrecision, chosenResolution, SaveType.Today); IUsageArchive archive = (IUsageArchive)CreateOrLoadKeeper(ref saveService, dataPrecision, chosenResolution, SaveType.Archive); IStorage store = new UsageStorage(ref today, ref archive, ref saveService); wService = new WatcherService(ref store); }
private void ArchiveIfNeeded() { var archivableUsages = usageToday.GetArchivableUsages(); usageArchive.Archive(archivableUsages); SavePreference savePreference = saveService.GetSavePreference(); if (!noArchiveList.Contains(savePreference) && archivableUsages.Count > 0) { usageArchive.DeleteUsagesOlderThen((int)savePreference); saveService.Save(usageArchive, SaveType.Archive); } }
public SaveService(string savePrefix, SavePreference preference, DataPrecision precision) { this.savePrefix = savePrefix; this.preference = preference; this.precision = precision; }
public SaveService(string appName, SavePreference preference, DataPrecision precision) { this.appName = appName; this.preference = preference; this.precision = precision; }