Пример #1
0
 /// <summary>
 /// Deletes this timeline from the API.
 /// </summary>
 public Task DeleteAsync(ITimelineService api)
 {
     return(api.PutJsonAsync("Timeline/Delete", new
     {
         TimelineId = Id,
     }));
 }
Пример #2
0
 /// <summary>
 /// Deletes the event with the specified ID from the API.
 /// </summary>
 public static Task DeleteAsync(ITimelineService api, string timelineEventId)
 {
     return(api.PutJsonAsync("TimelineEvent/Delete", new
     {
         TimelineEventId = timelineEventId
     }));
 }
Пример #3
0
 /// <summary>
 /// Unlinks the event with the ID from the timeline with the specified ID.
 /// </summary>
 public static Task UnlinkEventAsync(ITimelineService api, string timelineId, string timelineEventId)
 {
     return(api.PutJsonAsync("Timeline/UnlinkEvent", new
     {
         TimelineId = timelineId,
         EventId = timelineEventId
     }));
 }
Пример #4
0
 /// <summary>
 /// Saves a change to the event datetime of the event to the API.
 /// </summary>
 public Task EditEventDateTimeAsync(ITimelineService api)
 {
     return(api.PutJsonAsync("TimelineEvent/EditEventDateTime", new
     {
         TimelineEventId = Id,
         EventDateTime = EventDateTime.Ticks.ToString()
     }));
 }
Пример #5
0
 /// <summary>
 /// Saves a change to the location of the event to the API.
 /// </summary>
 public Task EditLocationAsync(ITimelineService api)
 {
     return(api.PutJsonAsync("TimelineEvent/EditLocation", new
     {
         TimelineEventId = Id,
         Location
     }));
 }
Пример #6
0
 /// <summary>
 /// Saves a change to the title of the event to the API.
 /// </summary>
 public Task EditTitleAsync(ITimelineService api)
 {
     return(api.PutJsonAsync("TimelineEvent/EditTitle", new
     {
         TimelineEventId = Id,
         Title
     }));
 }
Пример #7
0
        /// <summary>
        /// Creates a new timeline with the title.
        /// </summary>
        public static async Task <Timeline> CreateAsync(ITimelineService api, string title)
        {
            string json = await api.PutJsonAsync("Timeline/Create", new
            {
                TimelineId = Guid.NewGuid().ToString(),
                Title      = title
            });

            return(JsonConvert.DeserializeObject <Timeline>(json));
        }
Пример #8
0
        /// <summary>
        /// Creates a new attachment on the API for the specified timeline ID.
        /// </summary>
        public static async Task <Attachment> CreateAsync(ITimelineService api, string timelineEventId, string title)
        {
            string json = await api.PutJsonAsync("TimelineEventAttachment/Create", new
            {
                AttachmentId    = Guid.NewGuid().ToString(),
                TimelineEventId = timelineEventId,
                Title           = title
            });

            return(JsonConvert.DeserializeObject <Attachment>(json));
        }
Пример #9
0
        /// <summary>
        /// Creates a new event not linked to any timeline.
        /// </summary>
        private static async Task <TimelineEvent> CreateAsync(ITimelineService api, string id, string title, string description, DateTime eventDateTime, string location)
        {
            string json = await api.PutJsonAsync("TimelineEvent/Create", new
            {
                TimelineEventId = id,
                Title           = title,
                Description     = description,
                EventDateTime   = eventDateTime.Ticks.ToString(),
                Location        = location
            });

            return(JsonConvert.DeserializeObject <TimelineEvent>(json));
        }
Пример #10
0
        /// <summary>
        /// Deletes the attachment from the API.
        /// </summary>
        /// <param name="api"></param>
        /// <returns></returns>
        public async Task DeleteAsync(ITimelineService api)
        {
            await api.PutJsonAsync("TimelineEventAttachment/Delete", new
            {
                AttachmentId = Id
            });

            // Delete attachment from disk if it's there.
            var file = Path.Combine(api.CacheFolder, Name);

            if (api.FileExists(file))
            {
                api.FileDelete(file);
            }
        }