public async void TogglePrevisual(StorageEntry entry) { if (this.PrevisualEntry is null) { // 当前还没有正在预览的文件,应该开始文件预览的配置 await CreateNewPrevisualControl(entry); } else if (this.PrevisualEntry.DisplayName == entry.File.DisplayName) { // 当前已经有正在预览的文件,且触发该函数的是同一个文件,应该关闭预览 this.DismisssPrevisual(); } else { // 当前已经有正在预览的文件,且触发该函数的是另一个文件,应该注意对相同类型文件的处理 if (this.PrevisualEntry.ObjectType == entry.ContentType) { await UpdateCurrentPrevisualControl(entry); } else { await UpdateNewPrevisualControl(entry); } } }
public override async Task<List<IStorageItem>> PasteEntriesAsync(StorageFolder destFolder) { var newEntries = await base.PasteEntriesAsync(destFolder); // 执行Copy操作 if (newEntries.Count > 0) { var firstFileIndex = ObservableExtension.FirstIndex(entries, p => p.EntryType == StorageEntryType.File); List<StorageEntry> newFiles = new List<StorageEntry>(), newFolders = new List<StorageEntry>(); foreach (var storageItem in newEntries) { var newEntry = new StorageEntry(storageItem, StorageEntryUsage.TilesFieldItem); if (storageItem.IsOfType(StorageItemTypes.File)) { newFiles.Add(newEntry); } else { newFolders.Add(newEntry); } } // 首先插入文件 newFiles.ForEach(p => entries.Add(p)); // 然后插入文件夹 for(int i = 0; i < newFolders.Count; i++) { entries.Insert(firstFileIndex + i, newFolders[i]); } } return newEntries; }
public override void OpenFolderAsync(StorageEntry entryToOpen) { base.OpenFolderAsync(entryToOpen); this.folderEntry = entryToOpen; this.LoadEntries(); this.FLAgency.PushFolder(entryToOpen.Folder); }
public void DoubleReferenceCreateOneRemoveAndObjectStillNotGarbageCollected() { var gc = new GarbageCollector(); var rootEntry = new StorageEntry(0, "Next", 1); var node_1a = new StorageEntry(1, "Next_A", 2); var node_1b = new StorageEntry(1, "Next_B", 3); var node_2 = new StorageEntry(2, "Next", 3); var collectables = gc.Collect( new List <StorageEntry> { rootEntry, node_1a, node_1b, node_2 }, Enumerable.Empty <ObjectIdAndKey>() ).ToArray(); collectables.Length.ShouldBe(0); collectables = gc.Collect( new List <StorageEntry>() { new StorageEntry(2, "Next", null) }, Enumerable.Empty <ObjectIdAndKey>() ).ToArray(); collectables.Length.ShouldBe(0); }
public virtual async Task <bool> DeleteEntryAsync(StorageEntry entryToDelete) { if (!(await this.CheckStorageEntryExistAsync(entryToDelete))) { return(false); } if ((bool)PreferenceAgency.Default.GetLocalSetting(RIdentifiers.ShowDeleteConfirmation)) { var result = await Excutor.ShowMultiplyChooseDialogAsync( "Warning", $"Are you sure you want to move {entryToDelete.RawEntry.Name} to the Recycle Bin?", "Yes", "No"); if (!string.IsNullOrEmpty(result) && result == "Yes") { Excutor.DeleteEntryAsync(entryToDelete); } else { return(false); } } else { Excutor.DeleteEntryAsync(entryToDelete); } return(true); }
public Task WriteResultAsync(ServiceId serviceId, MethodId methodId, string intentId, ITaskResult result) { var serializedTaskResult = _serializer.SerializeToString(result); var expectedETag = (methodId as PersistedMethodId)?.ETag; lock (_entryMap) { if (!_entryMap.TryGetValue(intentId, out var entry)) { entry = new StorageEntry(); _entryMap.Add(intentId, entry); } else if (!string.IsNullOrEmpty(expectedETag) && entry.ETag != expectedETag) { throw new ETagMismatchException(expectedETag, entry.ETag); } entry["ServiceId"] = serviceId.Clone(); entry["MethodId"] = methodId.Clone(); entry["Result"] = serializedTaskResult; entry.ETag = DateTimeOffset.UtcNow.Ticks.ToString(); } return(Task.CompletedTask); }
public virtual async void OpenFolderAsync(StorageEntry entryToOpen) { if (!(await this.CheckStorageEntryExistAsync(entryToOpen))) { return; } }
public virtual async Task <IStorageItem> CreateStorageEntry(StorageEntry destFolder, StorageEntryType type) { (string result, string newName) = await Excutor.ShowSingleLineInputDialog(null, "Message", "Please Input the new name", "Confirm", "Cancel"); if (result == "Confirm" && !string.IsNullOrEmpty(newName)) { var isExisted = await StorageEntry.CheckStorageEntryExistAsync(newName, destFolder.Folder); // 检测该文件名是否冲突 if (isExisted) { string collisionAction = await Excutor.ShowMultiplyChooseDialogAsync( "Warning", $"{newName} has already existed in {destFolder.RawEntry.Name} folder.", "Generate new name", "Replace it", "Cancel"); switch (collisionAction) { case "Generate new name": return(await Excutor.CreatedNewEntry(destFolder, newName, type, CreationCollisionOption.GenerateUniqueName)); case "Replace it": return(await Excutor.CreatedNewEntry(destFolder, newName, type, CreationCollisionOption.ReplaceExisting)); case "Cancel": default: return(null); } } else { return(await Excutor.CreatedNewEntry(destFolder, newName, type, CreationCollisionOption.FailIfExists)); } } else { return(null); } }
public async void SwitchPreviewSource(StorageEntry displayEntry) { this.WholePreviewPanel.Visibility = Visibility.Collapsed; var newPreviewEntry = new StorageEntry(displayEntry.RawEntry, StorageEntryUsage.PanelPreview); await newPreviewEntry.GetEntrySizeAsyncIfNeed(); this.DataContext = newPreviewEntry; }
public override async Task<bool> DeleteEntryAsync(StorageEntry entryToDelete) { var isSucceed = await base.DeleteEntryAsync(entryToDelete); if (isSucceed) { entries.Remove(entryToDelete); } return isSucceed; }
/// <summary> /// 之前没有任何预览控件,创建新的预览的控件 /// </summary> private async Task CreateNewPrevisualControl(StorageEntry entry) { this.InitialPrevisualModel(entry); await PrevisualEntry.PreparePreviewAsync(); this.UpdatePrevisual(false); }
/// <summary> /// 重新现有的预览控件,配置新的数据 /// </summary> private async Task UpdateCurrentPrevisualControl(StorageEntry entry) { // 文件类型与上一个相同 this.PrevisualPopup.IsOpen = false; PrevisualEntry.ResetDataSource(entry.File); await PrevisualEntry.PreparePreviewAsync(); this.UpdatePrevisual(true); }
public async Task LaunchFolderInExplorer(StorageEntry parent, List <StorageEntry> entries) { if (!(await this.CheckStorageEntryExistAsync(parent))) { return; } var selectedList = (from entry in entries select entry as IStorageItem2).ToList(); bool isSucceed = await Excutor.LaunchFolderInExplorer(parent.Folder, selectedList, true); }
public override async Task<IStorageItem> CreateStorageEntry(StorageEntry destFolder, StorageEntryType type) { var createdItem = await base.CreateStorageEntry(destFolder, type); if(createdItem != null) { var newEntry = new StorageEntry(createdItem, StorageEntryUsage.TilesFieldItem); entries.Add(newEntry); TilesView.SelectedItem = newEntry; } return createdItem; }
private void InitialPrevisualModel(StorageEntry entry) { switch (entry.ContentType) { case SEContent.Image: PrevisualEntry = new MPrevisualImage(entry.File); break; default: throw new NotImplementedException(); } }
/// <summary> /// Stores an object to cache. /// </summary> /// <param name="typeId">The type identifier of the object.</param> /// <param name="instance">Required. The object to store.</param> /// <param name="options">The <see cref="LocalCacheOptions"/> to use for this /// operation.</param> /// <returns>The <see cref="StorageEntry{ICacheParameter}"/> containing the data /// saved. <see cref="StorageEntry{T}.NotFound"/> if local caching is disabled.</returns> /// <exception cref="ArgumentNullException"> /// <para><paramref name="instance"/> is <see langword="null"/>.</para> /// </exception> public static StorageEntry <ICacheParameter> Save(DataBuffer typeId, ICacheParameter instance, LocalCacheOptions options) { if (instance == null) { throw new ArgumentNullException("instance"); } if (!IsLocalCachingConfigured()) { return(StorageEntry <ICacheParameter> .NotFound); } DateTime? updated = null; StorageKey key; var ext = instance as IExtendedCacheParameter; if (ext != null) { key = new StorageKey(ext.ExtendedId, ext.PrimaryId); updated = ext.LastUpdatedDate; } else { var extRaw = instance as IExtendedRawCacheParameter; if (extRaw != null) { key = new StorageKey(extRaw.ExtendedId, extRaw.PrimaryId); updated = extRaw.LastUpdatedDate; } else { key = instance.PrimaryId; } } if (updated.HasValue) { if (options.Updated.HasValue && updated.Value != options.Updated.Value) { ThrowUpdatedDateTimeNotAllowed(); } } else { updated = options.Updated ?? DateTime.Now; } var entry = new StorageEntry <ICacheParameter>(instance, updated.Value, GetRefreshExpires(typeId)); _storage.Put(typeId, key, entry); SaveDependencies(typeId, key, updated.Value, options.ContentDependencies, options.ExistenceDependencies); return(entry); }
/// <summary> /// 创建一个新的预览控件取代已有的预览控件 /// </summary> private async Task UpdateNewPrevisualControl(StorageEntry entry) { // 文件类型与上一个不同 PrevisualEntry = null; this.PrevisualPopup.IsOpen = false; this.PrevisualContainer.Children.Remove(PrevisualControl); this.InitialPrevisualModel(entry); await PrevisualEntry.PreparePreviewAsync(); this.UpdatePrevisual(false); }
/// <summary> 检查文件或文件夹是否存在 </summary> private async Task <bool> CheckStorageEntryExistAsync(StorageEntry entryToCheck) { if (await StorageEntry.EntryExistAsync(entryToCheck)) { return(true); } else { Excutor.ShowMessageDialogAsync($"{entryToCheck.EntryType.ToString()} doesn't not exist.", "Operation Failed"); return(false); } }
public override async Task<bool> RenameEntryAsync(StorageEntry entryToRename, StorageEntry destFolder) { var isSucceed = await base.RenameEntryAsync(entryToRename, destFolder); if (isSucceed) { var index = entries.IndexOf(entryToRename); entries.Remove(entryToRename); entries.Insert(index, entryToRename); TilesView.SelectedItem = entryToRename; } return isSucceed; }
public override async Task CopyEntriesSourceAsync(StorageFolder destFolder, IReadOnlyList<IStorageItem> newItems) { List<StorageEntry> newEntries = new List<StorageEntry>(); foreach (var item in newItems) { var newEntry = new StorageEntry(item, StorageEntryUsage.TilesFieldItem); newEntries.Add(newEntry); } await this.CopyEntriesSourceAsync(destFolder, newEntries); // FIXME: 目前乱序直接插入到列表的最后 newEntries.ForEach(p => entries.Add(p)); }
// -------------------------------------------------------------------------------- // 打开文件相关 public virtual async void OpenFileAsync(StorageEntry entryToOpen) { if (!(await this.CheckStorageEntryExistAsync(entryToOpen))) { return; } bool isSucceed = await Excutor.LaunchFileAsync(entryToOpen.File, false); if (isSucceed == false) { Excutor.ShowMessageDialogAsync($"Open {entryToOpen.RawEntry.Name}" + " failed", "Operation Failed"); } }
// Navigate from PageFieldContainer protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var info = e.Parameter as MNavigateInfo <StorageFolder>; this.folderEntry = new StorageEntry(info.Message, StorageEntryUsage.ColumnFieldItem); this.Container = info.Navigator as PageFieldContainer; this.FLAgency = this.Container.GetFLAgencyRef(); this.PreviewPanel = this.Container.RefPreviewPanel; this.PrevisualView = this.Container.RefPrevisualView; this.FLAgency.SwitchServiceClient(this, MFolderLocationAgency.ServicePattern.TilesField); this.LoadEntries(); }
/// <summary> /// Stores an object to cache. /// </summary> /// <typeparam name="T">The type of the object.</typeparam> /// <param name="instance">Required. The object to store.</param> /// <param name="options">The <see cref="LocalCacheOptions"/> to use for this /// operation.</param> /// <returns>The <see cref="StorageEntry{T}"/> containing the data /// saved. <see cref="StorageEntry{T}.NotFound"/> if local caching is disabled.</returns> /// <exception cref="ArgumentNullException"> /// <para><paramref name="instance"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="ArgumentException"> /// <para><see cref="LocalCacheOptions.Updated"/> of <paramref name="options"/> /// has a value specified, which is not allowed for the cache type of /// <typeparamref name="T"/>.</para> /// </exception> public static StorageEntry <T> Save <T>(T instance, LocalCacheOptions options) where T : ICacheParameter { if (!IsLocalCachingConfigured()) { return(StorageEntry <T> .NotFound); } TypeStatic <T> .AssertNotNull("instance", instance); DateTime?updated = null; if (CacheTypeStatic <T> .IsExtendedCache) { var ext = (IExtendedCacheParameter)instance; updated = ext.LastUpdatedDate; } else if (CacheTypeStatic <T> .IsExtendedRawCache) { var extRaw = (IExtendedRawCacheParameter)instance; updated = extRaw.LastUpdatedDate; } if (updated.HasValue) { if (options.Updated.HasValue && updated.Value != options.Updated.Value) { ThrowUpdatedDateTimeNotAllowed(); } } else { updated = options.Updated ?? DateTime.Now; } var key = CacheTypeStatic <T> .GetKey(instance); var entry = new StorageEntry <T>(instance, updated.Value, GetRefreshExpires(instance, null)); var typeId = GetKeySpace(instance, null); _storage.Put(typeId, key, entry); SaveDependencies(typeId, key, updated.Value, options.ContentDependencies, options.ExistenceDependencies); return(entry); }
public void CorrectEntriesAreCollected() { var gc = new GarbageCollector(); var rootEntry = new StorageEntry(0, "Next", 1); var node_1 = new StorageEntry(1, "Next", 2); var node_2 = new StorageEntry(2, "Next", 3); var node_3 = new StorageEntry(3, "Next", 4); var gcs = new StorageEntry(10, "SomeKey", "SomeValue"); var collectables = gc.Collect( new List <StorageEntry> { rootEntry, node_1, node_2, node_3, gcs }, Enumerable.Empty <ObjectIdAndKey>() ).ToArray(); collectables.Length.ShouldBe(1); collectables[0].ShouldBe(10); collectables = gc.Collect( new List <StorageEntry>() { new StorageEntry(2, "Next", null) }, Enumerable.Empty <ObjectIdAndKey>() ).OrderBy(_ => _).ToArray(); collectables.Length.ShouldBe(2); collectables[0].ShouldBe(3); collectables[1].ShouldBe(4); collectables = gc.Collect( new List <StorageEntry>() { new StorageEntry(0, "Next", null) }, Enumerable.Empty <ObjectIdAndKey>() ).OrderBy(_ => _).ToArray(); collectables.Length.ShouldBe(2); collectables[0].ShouldBe(1); collectables[1].ShouldBe(2); }
// ------------------------------------------------------------------------- public virtual async Task <bool> RenameEntryAsync(StorageEntry entryToRename, StorageEntry destFolder) { if (!(await this.CheckStorageEntryExistAsync(entryToRename))) { return(false); } (string result, string newName) = await Excutor.ShowSingleLineInputDialog( entryToRename.RawEntry.Name, "Message", "Please Input the new name", "Confirm", "Cancel"); if (result == "Confirm" && !string.IsNullOrEmpty(newName)) { var isExisted = await StorageEntry.CheckStorageEntryExistAsync(newName, destFolder.Folder); // 检测该文件名算法冲突 if (isExisted) { string collisionAction = await Excutor.ShowMultiplyChooseDialogAsync( "Warning", $"{newName} has already existed in {destFolder.RawEntry.Name} folder.", "Generate new name", "Replace it", "Cancel"); switch (collisionAction) { case "Generate new name": return(await Excutor.RenameEntryAsync(entryToRename, newName, NameCollisionOption.GenerateUniqueName)); case "Replace it": return(await Excutor.RenameEntryAsync(entryToRename, newName, NameCollisionOption.ReplaceExisting)); case "Cancel": default: return(false); } } else { await Excutor.RenameEntryAsync(entryToRename, newName, NameCollisionOption.FailIfExists); return(true); } } else { return(false); } }
public Task <string> WriteStateAsync( ServiceId serviceId, PersistedMethodId methodId, MethodExecutionState state) { var serializedState = _serializer.SerializeToString(state.MethodState); var serializedContinuation = state.Continuation != null?_serializer.SerializeToString(state.Continuation) : null; var serializedFlowContext = state.FlowContext?.Count > 0 ? _serializer.SerializeToString(state.FlowContext) : null; var expectedETag = methodId.ETag; var intentId = methodId.IntentId; lock (_entryMap) { if (!_entryMap.TryGetValue(intentId, out var entry)) { entry = new StorageEntry(); _entryMap.Add(intentId, entry); } else if (!string.IsNullOrEmpty(expectedETag) && entry.ETag != expectedETag) { throw new ETagMismatchException(expectedETag, entry.ETag); } entry.ETag = DateTimeOffset.UtcNow.Ticks.ToString(); entry["ServiceId"] = state.Service.Clone(); entry["MethodId"] = state.Method.Clone(); entry["Caller"] = state.Caller?.Clone(); entry["State"] = serializedState; entry["Continuation"] = serializedContinuation; entry["FlowContext"] = serializedFlowContext; if (state.ContinuationState != null) { entry["Continuation:Format"] = state.ContinuationState.Format; entry["Continuation:State"] = state.ContinuationState.State; } return(Task.FromResult(entry.ETag)); } }
public async Task <StorageResponse> Get(string id, KeyType keyType, DateTime?from = null, DateTime?to = null, string filter = "", string token = "") { var response = new StorageResponse(); var entrys = new List <StorageEntry>(); var contToken = _tokenSerializer.DeSerialize(token); TableQuerySegment <DynamicTableEntity> storageRequest = await GetData(id, keyType, contToken, from, to, filter); response.ContinuationToken = _tokenSerializer.Serialize(storageRequest.ContinuationToken); var headings = new List <string>(); for (int i = 0; i < storageRequest.Results.Count; i++) { var item = storageRequest.Results[i]; if (i == 0) { foreach (var key in item.Properties.Keys) { headings.Add(key); } } var entry = new StorageEntry { PartitionKey = item.PartitionKey, RowKey = item.RowKey, TimeStamp = item.Timestamp }; var values = new List <string>(); foreach (var key in headings) { values.Add(item.Properties.ContainsKey(key) ? GetValue(item.Properties[key]).ToString() : ""); } entry.Values = values; entrys.Add(entry); } response.Headings = headings; response.StorageEntries = entrys; return(response); }
public async Task LaunchFolderInExplorer(StorageEntry entry) { if (!(await this.CheckStorageEntryExistAsync(entry))) { return; } bool isSucceed = false; switch (entry.EntryType) { case StorageEntryType.Folder: isSucceed = await Excutor.LaunchFolderInExplorer(entry.Folder); break; case StorageEntryType.File: isSucceed = await Excutor.LaunchFolderInExplorer(entry.RawEntry2, true); break; } if (!isSucceed) { Excutor.ShowMessageDialogAsync($"Open {entry.RawEntry.Name} {entry.EntryType.ToString()}" + " failed", "Operation Failed"); } }
public static async void RunAsync([TimerTrigger("0 */1 * * * *")] TimerInfo myTimer, ILogger log) { try { log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); var cloudTable = GetStorageTableConnection(log, "WearableActivityTable"); var deviceSyncTime = await GetDeviceSyncTime(log); var cloudTableQuery = new TableQuery().Take(1); var mostRecentEntry = cloudTable.ExecuteQuery(cloudTableQuery).FirstOrDefault(); var mostRecentEntryTime = new DateTime(DateTime.MaxValue.Ticks - Convert.ToInt64(mostRecentEntry.RowKey)); var mostRecentEntryInsertTime = DateTime.Parse(mostRecentEntry.Properties.Where(d => d.Key == "InsertTime").FirstOrDefault().Value.ToString()); // in some cases we want to exit early so we don't strain the API var ticksInMinute = 10000000 * 60; var minutesSinceInsertedEntry = (DateTime.Now.Ticks - mostRecentEntryInsertTime.Ticks) / ticksInMinute; var minutesSinceLastEntry = (DateTime.Now.Ticks - mostRecentEntryTime.Ticks) / ticksInMinute; var minutesSinceSync = (DateTime.Now.Ticks - deviceSyncTime.Ticks) / ticksInMinute; var minutesEntryBehindSync = minutesSinceLastEntry - minutesSinceSync; log.LogInformation("\tminutesSinceInsertedEntry:" + minutesSinceInsertedEntry); log.LogInformation("\tminutesSinceLastEntry:" + minutesSinceLastEntry); log.LogInformation("\tminutesSinceSync:" + minutesSinceSync); log.LogInformation("\tminutesEntryBehindSync:" + minutesEntryBehindSync); var completeDataUpdate = true; // If we are behind by more than an hour AND we just wrote an entry, then exit. // This will be hit if we are catching up. We get 6 hours of data at a time, so // we can take small breaks. if (minutesEntryBehindSync > 60 && minutesSinceInsertedEntry < 2) { completeDataUpdate = false; } // if entries is caught up to the sync time, then we don't // have any data to update if (minutesEntryBehindSync == 0) { completeDataUpdate = false; } log.LogInformation("\tcompleteDataUpdate:" + completeDataUpdate); if (completeDataUpdate) { DateTime startTime = mostRecentEntryTime.AddMinutes(1); DateTime endTime = mostRecentEntryTime.AddMinutes(60 * 12); if (endTime > deviceSyncTime) { endTime = deviceSyncTime; } if (startTime.Date != endTime.Date) // rolling over midnight { endTime = new DateTime(startTime.Year, startTime.Month, startTime.Day, 23, 59, 00); } log.LogInformation("\tstartTime:" + startTime.ToString("MM/dd/yyyy HH:mm:ss")); log.LogInformation("\tendTimeTime:" + endTime.ToString("MM/dd/yyyy HH:mm:ss")); var heartRateResponse = GetHRDataAsync(startTime, endTime, log).Result; var stepResponse = GetStepDataAsync(startTime, endTime, log).Result; var heartRateData = heartRateResponse.heartRateIntraday.dataset; var stepData = stepResponse.stepIntraday.dataset; List <String> allTimes = new List <String>(); var heartRateTimes = heartRateData.Select(d => d.time).ToList(); var stepTimes = stepData.Select(d => d.time).ToList(); allTimes.AddRange(heartRateTimes); // in the case that the fitbit doesn't collect data for several hours // we won't ever make a new entry. We need log an entry with no data, // so that we can move on if (minutesEntryBehindSync > 120) { DateTime fillerTime = new DateTime(endTime.Year, endTime.Month, endTime.Day, endTime.Hour, endTime.Minute, 0); allTimes.Add(fillerTime.ToString("yyyy-MM-dd HH:mm:ss")); } allTimes.Distinct(); foreach (String timeDatapoint in allTimes) { var heartRateDatapoint = heartRateData.Where(d => d.time == timeDatapoint).FirstOrDefault(); var stepDatapoint = stepData.Where(d => d.time == timeDatapoint).FirstOrDefault(); var heartRate = heartRateDatapoint != null ? heartRateDatapoint.value : 0; var steps = stepDatapoint != null ? stepDatapoint.value : 0; DateTime dt = DateTime.Parse(timeDatapoint); StorageEntry storageEntry = new StorageEntry(heartRate, steps, dt); storageEntry.Timestamp = dt; var tableOperation = TableOperation.InsertOrReplace(storageEntry); cloudTable.Execute(tableOperation); var minutesEntryBehindPresent = (DateTime.Now.Ticks - storageEntry.Timestamp.Ticks) / ticksInMinute; minutesEntryBehindPresent -= 300; //-300 is to accomodate timezones var minutesSinceLastText = (DateTime.Now.Ticks - lastTextSent.Ticks) / ticksInMinute; log.LogInformation("\tminutesEntryBehindPresent" + minutesEntryBehindPresent); log.LogInformation("\tminutesSinceLastText" + minutesSinceLastText); if (minutesEntryBehindPresent < 30 && minutesSinceLastText > 5) { var activityClassification = ClassifyActivity(storageEntry.Steps, storageEntry.HeartRate, log); log.LogInformation("\tactivityClassification" + activityClassification); if (activityClassification == "Run") { await SendTextAsync(log); } } } } } catch (Exception e) { log.LogError(e.Message); } }
private StorageEntry EnsureStorageEntry() { var storageEntries = StorageEntries().ToList(); if (storageEntries.Count == 0) { var storageEntry = new StorageEntry(_id); _container.Store(storageEntry); return storageEntry; } return storageEntries[0]; }
public void Remove(StorageEntry entry) { throw new Exception("The method or operation is not implemented."); }