Esempio n. 1
0
        public void AddImage(EventImage image)
        {
            Event e = EventList.FirstOrDefault((arg) => arg.Id == image.EventId);

            e?.Images.Add(image);
            localDb.WriteEventImage(image);
            SortEventImageList(e);
            //DependencyService.Get<EventSyncInterface>().UploadNewImageLowRes(image);
        }
        public async Task <long> RemoveEventImage(EventImage image)
        {
            // TODO: this Get method can throw a NotFoundException, surround with try - catch block
            Event e = await dbConnection.FindAsync <Event>((Event de) => de.Id == image.EventId);

            await dbConnection.DeleteAsync(image);

            return(e?.Id ?? -1);
        }
Esempio n. 3
0
 public override void Update(BaseModel update)
 {
     base.Update(update);
     if (update is EventImage)
     {
         EventImage img = update as EventImage;
         Caption       = img.Caption;
         Path          = img.Path;
         PathSmall     = img.PathSmall;
         EventId       = img.EventId;
         EventMemberId = img.EventMemberId;
         DateTaken     = img.DateTaken;
     }
 }
Esempio n. 4
0
        public void AddToEventImageList(Event e, EventImage img, bool updateIfExisting = false)
        {
            int index = e.Images.IndexOf(img);

            if (index >= 0)
            {
                if (updateIfExisting)
                {
                    e.Images.Update(index, img);
                }
            }
            else
            {
                e.Images.Add(img);
            }
        }
Esempio n. 5
0
        public async Task Remove(EventImage image)
        {
            long eventId = await localDb.RemoveEventImage(image);

            if (eventId != -1)
            {
                int eventIndex = EventList.IndexOf(new Event {
                    Id = eventId
                });
                if (eventIndex >= 0)
                {
                    EventList[eventIndex].Images.Remove(image);
                }
                SortEventImageList(EventList[eventIndex]);
            }
            DeleteFileWithDialog(image.Path);
            DeleteFileWithDialog(image.PathSmall);
        }
 public void WriteEventImage(EventImage eventImage)
 {
     // TODO: verify that all properties are set
     dbConnection.InsertAsync(eventImage);
 }