/// <summary>
 /// Initializes a new instance of the SelectEndDateViewModel class.
 /// </summary>
 public SelectEndDateViewModel(INavigationService navigationService)
 {
     Messenger.Default.Register<int>(this,
     trip =>
     {
     DataServiceTrip dsTrip = new DataServiceTrip();
     this.Trip = dsTrip.getTripById(trip);
     Date = DateTime.Now;
     InitialiseValidator();
     });
     this._navigationService = navigationService;
 }
        /// <summary>
        /// Initializes a new instance of the CurrentViewModel class.
        /// </summary>
        public CurrentViewModel()
        {
            Messenger.Default.Register<int>(this,
            trip =>
            {
            DataServiceTrip dsTrip = new DataServiceTrip();
            Trip = dsTrip.getTripById(trip);

            RaisePropertyChanged("ElapsedDays");
            RaisePropertyChanged("CountNotes");
            RaisePropertyChanged("CountPhotos");
            RaisePropertyChanged("CountPOI");
            });
        }
        /// <summary>
        /// Initializes a new instance of the TripViewModel class.
        /// </summary>
        public TripViewModel(INavigationService navigationService)
        {
            Messenger.Default.Register<int>(this,
            trip =>
            {
            DataServiceTrip dsTrip = new DataServiceTrip();
            this.Trip = dsTrip.getTripById(trip);

            RaisePropertyChanged("NoteTitle");
            RaisePropertyChanged("PhotoTitle");
            RaisePropertyChanged("POITitle");
            });
            this._navigationService = navigationService;
        }
        /// <summary>
        /// Initializes a new instance of the AddPOIViewModel class.
        /// </summary>
        public AddEditPOIViewModel(INavigationService navigationservice)
        {
            Messenger.Default.Register<Tuple<int, int, Mode>>(this,
             tuple =>
             {
             this.Mode = tuple.Item3;

             if (this.Mode == Mode.add)
             {
             PointOfInterest = new Model.Tables.PointOfInterest();
             DataServiceTrip dsTrip = new DataServiceTrip();
             PointOfInterest.Trip = dsTrip.getTripById(tuple.Item1);
             }
             else
             {
             PointOfInterest = GetPOIInDB(tuple.Item2);
             }

             EditableObject = new Caretaker<PointOfInterest>(this.PointOfInterest);
             EditableObject.BeginEdit();

             InitialiseValidator();
             });

            Messenger.Default.Register<PointOfInterest>(this,
             poi =>
             {
             PointOfInterest = poi;

             });

            Messenger.Default.Register<Tuple<PointOfInterest,Mode>>(this,
            tuple =>
            {
            this.Mode = tuple.Item2;
            PointOfInterest = tuple.Item1;

            EditableObject = new Caretaker<PointOfInterest>(this.PointOfInterest);
            EditableObject.BeginEdit();

            InitialiseValidator();
            });

            this._navigationService = navigationservice;
        }
        public ListPhotoViewModel(INavigationService navigationService)
        {
            Messenger.Default.Register<Tuple<int, PointOfInterest>>(this,
            tuple =>
            {
            DataServiceTrip dsTrip = new DataServiceTrip();
            this.Trip = dsTrip.getTripById(tuple.Item1);
            this.PoiLoaded = tuple.Item2;
            Loading = true;
            });

            Messenger.Default.Register<int>(this,
            trip =>
            {
            DataServiceTrip dsTrip = new DataServiceTrip();
            this.Trip = dsTrip.getTripById(trip);
            Loading = true;
            this.PoiLoaded = null;
            });

            this._navigationService = navigationService;
        }
        private void Init(int trip, int note, PointOfInterest poi, Mode mode)
        {
            this.Mode = mode;

            if (this.Mode == ViewModels.Mode.add)
            {
                Note = new Note();
                DataServiceTrip dsTrip = new DataServiceTrip();
                Note.Trip = dsTrip.getTripById(trip);
                Note.Date = DateTime.Now;
                if (poi != null)
                    this.POISelected = poi;
            }
            else
            {
                Note = GetNoteInDB(note);
            }

            if (Note.Trip.PointsOfInterests != null)
                _poiList = new List<PointOfInterest>(Note.Trip.PointsOfInterests);

            EditableObject = new Caretaker<Note>(this.Note);
            EditableObject.BeginEdit();

            InitialiseValidator();
        }
        /// <summary>
        /// Initializes a new instance of the AddTripViewModel class.
        /// </summary>
        public AddEditTripViewModel(INavigationService navigationService)
        {
            Messenger.Default.Register<Tuple<int, Mode>>(this,
            tuple =>
            {
            this.Mode = tuple.Item2;
            Departure = String.Empty;
            Destination = String.Empty;

            if (this.Mode == Mode.add)
            {
            Trip = new Trip();
            Trip.BeginDate = DateTime.Now;
            }
            else
            {
            DataServiceTrip dsTrip = new DataServiceTrip();
            this.Trip = dsTrip.getTripById(tuple.Item1);
            }

            this.FriendList = Utility.FriendToList(Trip.FriendList);
            InitialiseValidator();

            EditableObject = new Caretaker<Trip>(this.Trip);
            EditableObject.BeginEdit();
            });

            this._navigationService = navigationService;
        }
        private void Init(int trip, int photo, PointOfInterest poi, Mode mode)
        {
            this.Mode = mode;

            if (this.Mode == ViewModels.Mode.add)
            {
                Picture = new Picture();
                DataServiceTrip dsTrip = new DataServiceTrip();
                Picture.Trip = dsTrip.getTripById(trip);
                Picture.Date = DateTime.Now;
                if (poi != null)
                    POISelected = poi;
            }
            else
            {
                Picture = GetPictureInDB(photo);
            }

            if (Picture.Trip.PointsOfInterests != null)
                PoiList = new List<PointOfInterest>(Picture.Trip.PointsOfInterests);

            EditableObject = new Caretaker<Picture>(this.Picture);
            EditableObject.BeginEdit();

            InitialiseValidator();
        }