Exemplo n.º 1
0
 public void DeleteItem(MyTextItem item)
 {
     if (item != null)
     {
         this.DeleteItem(item.Id);
     }
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        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);
        }