Exemplo n.º 1
0
        private async Task <bool> GetPinsForGivenDate(DateTime startTime, DateTime endTime)
        {
            bool ret = false;

            while (startTime.Date.Date <= endTime.Date.Date)
            {
                var pins = await localData.GetLocationPinsByDate(startTime);

                if (pins != null && pins.Count > 0)
                {
                    foreach (LocationPin pin in pins)
                    {
                        if (pin.IsCheckPoint && pin.Photo != null)
                        {
                            this.ViewModel.CheckedLocations.Add(pin);
                        }
                    }
                }
                startTime = startTime.AddDays(1);
            }
            if (this.ViewModel.CheckedLocations.Count() > 0)
            {
                var numberOfPolylines = ViewModel.drawPolylines(this.ViewModel.CheckedLocations, this.InputMap);
                await ViewModel.setViewOnMap(numberOfPolylines, this.InputMap);
            }
            tripItem.Pin = this.ViewModel.CheckedLocations.ToList();
            return(ret);
        }
Exemplo n.º 2
0
        private async Task <bool> GetPinsForGivenDate()
        {
            bool ret = false;

            this.ViewModel.PinnedLocations.Clear();
            this.ViewModel.CheckedLocations.Clear();
            this.ViewModel.MileStoneLocations.Clear();
            CheckPointSlider.Maximum             = 0;
            this.ViewModel.PinDisplayInformation = new LocationPin();
            CheckPointSlider.Value = 0;
            this.InputMap.MapElements.Clear();
            allPins = await localData.GetLocationPinsByDate(HistoryDatePicker.Date.Date);

            if (allPins != null && allPins.Count > 0)
            {
                foreach (LocationPin pin in allPins)
                {
                    if (pin.DateCreated.Date == HistoryDatePicker.Date.Date)
                    {
                        this.ViewModel.PinnedLocations.Add(pin);
                        if (pin.IsCheckPoint)
                        {
                            this.ViewModel.CheckedLocations.Add(pin);
                        }
                    }
                }
                var numberOfPolylines = ViewModel.drawPolylines(this.ViewModel.PinDisplayInformation, true, this.InputMap);
                if (this.ViewModel.PinnedLocations.Count > 0)
                {
                    ret = !ret;
                }
                CheckPointSlider.Maximum = this.ViewModel.MileStoneLocations.Count() - 1;

                // Set the current view of the map control.
                var positions = this.ViewModel.PinnedLocations.Select(loc => loc.Position).ToList();
                //if (currentLocation != null)
                //    positions.Insert(0, currentLocation.Position);
                await ViewModel.setViewOnMap(positions, this.InputMap);
            }
            return(ret);
        }