public void DeleteItem(MyTextItem item) { if (item != null) { this.DeleteItem(item.Id); } }
public MyTextItem CreateItem() { MyTextItem item = new MyTextItem { Id = Guid.NewGuid(), Created = DateTime.UtcNow, LastModified = DateTime.UtcNow }; this.cacheProvider?.AddOrUpdate(item.Id.ToString(), item); return(item); }
private async Task GenerateTimelineActivityAsync(MyTextItem item) { UserActivityChannel channel = UserActivityChannel.GetDefault(); UserActivity userActivity = await channel.GetOrCreateUserActivityAsync(item.Id.ToString()); userActivity.VisualElements.DisplayText = item.Content; userActivity.VisualElements.Description = $"Last saved: {item.LastModified}"; userActivity.ActivationUri = new Uri($"mytext://editor?id={item.Id}"); await userActivity.SaveAsync(); this.currentActivity?.Dispose(); this.currentActivity = userActivity.CreateSession(); }
public async Task SaveItemAsync(Guid id, string content) { MyTextItem item = this.GetItem(id); if (item == null) { return; } item.Content = content; item.LastModified = DateTime.UtcNow; this.cacheProvider.AddOrUpdate(item.Id.ToString(), item); await this.GenerateTimelineActivityAsync(item); }