/// <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;
        }
Exemple #2
0
        public void LoadAllCoordinateFromDatabase()
        {
            DataServiceTrip dsTrip      = new DataServiceTrip();
            List <Trip>     allTripInDB = dsTrip.LoadTrip();

            TripPoints = new ObservableCollection <Trip>(allTripInDB);
        }
        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();
        }
        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();
        }
        private void DeleteTrip(Trip trip)
        {
            DataServiceTrip dsTrip = new DataServiceTrip();

            dsTrip.DeleteTrip(trip);
            Messenger.Default.Send <List <Trip>, TimelineViewModel>(ArchiveTripList.ToList());
        }
Exemple #6
0
        private void TripNav()
        {
            DataServiceTrip dsTrip = new DataServiceTrip();

            TripList = dsTrip.LoadTrip();
            Messenger.Default.Send <int, TripViewModel>(TripList.Find(x => x.IsActif).Id);
            _navigationService.NavigateTo("TripView");
        }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the StatisticViewModel class.
 /// </summary>
 public StatisticViewModel()
 {
     Messenger.Default.Register <int>(this,
                                      trip =>
     {
         DataServiceTrip dsTrip = new DataServiceTrip();
         this.Trip           = dsTrip.getTripById(trip);
         PointOfInterestList = new ObservableCollection <PointOfInterest>(Trip.PointsOfInterests);
         TripFriends         = new ObservableCollection <string>(Utils.Utility.FriendToList(Trip.FriendList));
     });
 }
        /// <summary>
        /// Initializes a new instance of the POIViewModel class.
        /// </summary>
        public ListPOIViewModel(INavigationService navigationService)
        {
            Messenger.Default.Register <int>(this,
                                             trip =>
            {
                DataServiceTrip dsTrip = new DataServiceTrip();
                this.Trip           = dsTrip.getTripById(trip);
                PointOfInterestList = new ObservableCollection <PointOfInterest>(Trip.PointsOfInterests);
            });

            this._navigationService = navigationService;
        }
Exemple #9
0
 /// <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;
 }
Exemple #10
0
 public void FinishTrip()
 {
     if (ValidationErrorsHandler.IsValid(_validator, Trip))
     {
         _isFormValid = true;
         DataServiceTrip dsTrip = new DataServiceTrip();
         dsTrip.UpdateTrip(Trip);
     }
     else
     {
         _isFormValid = false;
     }
 }
Exemple #11
0
        /// <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 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 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;
        }
Exemple #14
0
        public ListNoteViewModel(INavigationService navigationService)
        {
            Messenger.Default.Register <Tuple <int, PointOfInterest> >(this,
                                                                       tuple =>
            {
                DataServiceTrip dsTrip = new DataServiceTrip();
                this.Trip      = dsTrip.getTripById(tuple.Item1);
                this.PoiLoaded = tuple.Item2;
            });

            Messenger.Default.Register <int>(this,
                                             trip =>
            {
                DataServiceTrip dsTrip = new DataServiceTrip();
                this.Trip      = dsTrip.getTripById(trip);
                this.PoiLoaded = null;
            });
            this._navigationService = navigationService;
        }
        public void LoadArchivesTripFromDatabase()
        {
            DataServiceTrip dsTrip = new DataServiceTrip();

            TripList = dsTrip.LoadTrip();
        }
        public void AddTripInDB()
        {
            DataServiceTrip dsTrip = new DataServiceTrip();

            dsTrip.addTrip(Trip);
        }
        public void UpdateExistingTrip()
        {
            DataServiceTrip dsTrip = new DataServiceTrip();

            dsTrip.UpdateTrip(Trip);
        }
Exemple #18
0
        public void DeleteTrip()
        {
            DataServiceTrip dsTrip = new DataServiceTrip();

            dsTrip.DeleteTrip(Trip);
        }