/// <summary>
        /// Ajout ou modification d'une photo
        /// </summary>
        public void AddEditPhoto()
        {
            // If the form is not valid, a notification will appear
            if (ValidationErrorsHandler.IsValid(_validator, Picture))
            {
                _isFormValid = true;

                if (NoneCheck)
                {
                    Picture.PointOfInterest = null;
                }

                if (Mode == Mode.add)
                {
                    AddPictureInDB();
                }
                else if (Mode == Mode.edit)
                {
                    UpdateExistingPicture();
                }

                EditableObject.EndEdit();
            }
            else
            {
                _isFormValid = false;
            }
        }
        public void AddEditTrip()
        {
            // If the form is not valid, a notification will appear
            if (ValidationErrorsHandler.IsValid(_validator, Trip))
            {
                _isFormValid    = true;
                Trip.FriendList = Utils.Utility.FriendToString(FriendList);
                // Adding a Trip
                if (Mode == Mode.add)
                {
                    AddTripInDB();
                    Messenger.Default.Send <string, MainViewModel>("");
                }
                else if (Mode == Mode.edit)
                {
                    UpdateExistingTrip();
                }

                EditableObject.EndEdit();
            }
            else
            {
                _isFormValid = false;
            }
        }
        /// <summary>
        /// Ajouter ou modifier une note
        /// </summary>
        public void AddEditNote()
        {
            // If the form is not valid, a notification will appear
            if (ValidationErrorsHandler.IsValid(_validator, Note))
            {
                _isFormValid = true;

                if (NoneCheck)
                {
                    Note.PointOfInterest = null;
                }

                if (Mode == Mode.add)
                {
                    AddNoteInDB();
                }
                else if (Mode == Mode.edit)
                {
                    UpdateExistingNote();
                    Messenger.Default.Send <int, NoteViewModel>(Note.Id);
                }

                EditableObject.EndEdit();
            }
            else
            {
                _isFormValid = false;
            }
        }
        private void SaveCheckList()
        {
            IsFormValid = true;

            this.Tour.RecentRenovations = Utils.Utility.ListToString(RecentRenovations.Select(reno => reno.Name).ToList());
            DataServiceTour dsTour = new DataServiceTour();

            dsTour.UpdateTour();
            EditableObject.EndEdit();
            navigationService.GoBack();
        }
Пример #5
0
        void ObservableRowChanged(DataRowChangeEventArgs e)
        {
            if (e.Action != DataRowAction.Add && e.Action != DataRowAction.Delete && e.Action != DataRowAction.Change)
            {
                return;
            }

            if (e.Action == DataRowAction.Add || e.Action == DataRowAction.Change)
            {
                SetRowIndexInCurrentAction(e);
            }

            EditableObject.EndEdit();
        }
 private void AddEditTour()
 {
     IsFormValid = true;
     if (CurrentMode == Mode.NewTour)
     {
         Tour.ConstructionYear = DateTime.Now.Year;
         AddTour();
     }
     else
     {
         EditTour();
     }
     EditableObject.EndEdit();
     Messenger.Default.Send <Tour, CheckListViewModel>(Tour);
     navigationService.NavigateTo("CheckList");
 }
        /// <summary>
        /// Ajout d'un point d'intérêt
        /// </summary>
        public void AddPOI()
        {
            if (ValidationErrorsHandler.IsValid(_validator, PointOfInterest))
            {
                _isFormValid = true;
                // Adding a poi
                if (Mode == Mode.add || Mode == Mode.addFromExisting)
                {
                    AddPoiInDB();
                }
                else
                {
                    UpdateExistingPOI();
                }

                EditableObject.EndEdit();
            }
            else
            {
                _isFormValid = false;
            }
        }