示例#1
0
        /// <summary>
        /// Suppression d'une photo
        /// </summary>
        public void DeletePicture()
        {
            DataServicePicture dsPicture = new DataServicePicture();

            dsPicture.DeletePicture(SelectedPicture);
            Trip.Pictures.Remove(SelectedPicture);
            GoBackCommand.Execute(null);
        }
        public void DeletePicture(Picture picture)
        {
            DataServicePicture dsPicture = new DataServicePicture();

            Trip.Pictures.Remove(picture);
            dsPicture.DeletePicture(picture);

            TripCommand.Execute(null);
        }
        private void AddPictureInDB()
        {
            // Workaround explained in AddEditNoteViewModel
            // Each lines must be there
            Picture.Trip.Pictures.Add(Picture);

            DataServicePicture dsPicture = new DataServicePicture();

            dsPicture.addPicture(Picture);
        }
示例#4
0
        public PhotoViewModel(INavigationService navigationService)
        {
            Messenger.Default.Register <int>(this,
                                             picture =>
            {
                DataServicePicture dsPicture = new DataServicePicture();
                this.Trip            = dsPicture.getPictureById(picture).Trip;
                SelectedPictureIndex = Trip.Pictures.OrderBy(x => x.Date).ToList().FindIndex(x => x.Id == picture);
            });

            this._navigationService = navigationService;
        }
        public void DeletePictures(List <object> pictureList)
        {
            DataServicePicture dsPicture = new DataServicePicture();

            foreach (Picture picture in pictureList)
            {
                Trip.Pictures.Remove(picture);
                dsPicture.DeletePicture(picture);
            }

            TripCommand.Execute(null);
        }
        public void DeletePOI(PointOfInterest poi)
        {
            if (DeletePOIObject)
            {
                // For some reasons, Picture table doesn't refresh properly
                // We have to remove each element in the array manually
                DataServicePicture dsPicture = new DataServicePicture();
                foreach (Picture pic in dsPicture.LoadPicturesByPoiId(poi.Id))
                {
                    Trip.Pictures.Remove(pic);
                    dsPicture.DeletePicture(pic);
                }

                DataServiceNote dsNotes = new DataServiceNote();
                foreach (Note note in dsNotes.LoadNotesByPoiId(poi.Id))
                {
                    Trip.Notes.Remove(note);
                    dsNotes.DeleteNote(note);
                }
            }
            else
            {
                // For some reasons, Picture table doesn't refresh properly
                // We have to remove each element in the array manually
                DataServicePicture dsPicture = new DataServicePicture();
                foreach (Picture pic in dsPicture.LoadPicturesByPoiId(poi.Id))
                {
                    pic.PointOfInterest = null;
                }

                DataServiceNote dsNotes = new DataServiceNote();
                foreach (Note note in dsNotes.LoadNotesByPoiId(poi.Id))
                {
                    note.PointOfInterest = null;
                }
            }

            DataServicePoi dsPoi = new DataServicePoi();

            Trip.PointsOfInterests.Remove(poi);
            PointOfInterestList.Remove(poi);

            dsPoi.DeletePoi(poi, false);

            TripCommand.Execute(null);
        }
        private Picture GetPictureInDB(int pictureId)
        {
            DataServicePicture dsPicture = new DataServicePicture();

            return(dsPicture.getPictureById(pictureId));
        }
        private void UpdateExistingPicture()
        {
            DataServicePicture dsPicture = new DataServicePicture();

            dsPicture.UpdatePicture(Picture);
        }