コード例 #1
0
        public MainViewModel(INavigation navigation)
        {
            this.navigation = navigation;

            locationService = new LocationInMemoryService();
            Listlocations   = new ObservableCollection <ListLocation>(locationService.GetAllList().Result);
        }
コード例 #2
0
        public LocationViewModel(ListLocation location, INavigation navigation)
        {
            this.navigation = navigation;

            listLocation    = location;
            locationService = new LocationInMemoryService();

            Locations = new ObservableCollection <Location>(locationService.GetAll(location).Result);
        }
コード例 #3
0
        public LocationViewModel(LocationList currentLocationList, Location currentLocation, INavigation navigation)
        {
            this.navigation      = navigation;
            this.currentLocation = currentLocation;
            locationService      = new LocationInMemoryService();

            // initialize the properties with data from current location
            this.Latitude     = currentLocation.Latitude;
            this.Longitude    = currentLocation.Longitude;
            this.LocationTime = currentLocation.LocationTime;
            this.LocationName = currentLocation.LocationName;
            this.ListName     = currentLocationList.ListName;
        }
コード例 #4
0
        public TrackingViewModel(INavigation navigation)
        {
            this.navigation = navigation;
            locationService = new LocationInMemoryService();

            // Initialize the location collection,
            LocationLists = new ObservableCollection <LocationList>(locationService.GetAll().Result);

            // take the first LocationList
            //selectedLocationList = (LocationList)(locationService.GetLocationLists().Result.Where(l => l.ListName == "Ronde 1").FirstOrDefault());
            selectedLocationList = (LocationList)(locationService.GetLocationLists().Result.FirstOrDefault());
            this.ListName        = "";

            if (locationService.GetByListName(selectedLocationList.ListName).Result == null)
            {
                Locations = null;
            }
            else
            {
                Locations = new ObservableCollection <Location>(locationService.GetByListName(selectedLocationList.ListName).Result);
            }

            // Listen to the messaging center to inform if a location is saved and refresh the Listview
            MessagingCenter.Subscribe(this, MessageLocations.LocationSaved,
                                      async(LocationViewModel sender, Location loc) =>
            {
                Locations = new ObservableCollection <Location>(await locationService.GetByListName(selectedLocationList.ListName));
            });

            // Listen to the messaging center to inform if a locationList is saved and refresh the Picker
            MessagingCenter.Subscribe(this, MessageLocations.LocationListSaved,
                                      async(TrackingViewModel sender, LocationList locList) =>
            {
                LocationLists = new ObservableCollection <LocationList>(await locationService.GetAll());
            });
        }
コード例 #5
0
 public MainViewModel()
 {
     locationService = new LocationInMemoryService();
     Listlocations   = new ObservableCollection <ListLocation>(locationService.GetAllList().Result);
 }