Exemplo n.º 1
0
 /// <summary>
 /// Deletes this timeline from the API.
 /// </summary>
 public Task DeleteAsync(ITimelineService api)
 {
     return(api.PutJsonAsync("Timeline/Delete", new
     {
         TimelineId = Id,
     }));
 }
Exemplo n.º 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
     }));
 }
Exemplo n.º 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
     }));
 }
Exemplo n.º 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()
     }));
 }
Exemplo n.º 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
     }));
 }
Exemplo n.º 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
     }));
 }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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);
            }
        }