Example #1
0
        public async void EntregasPendientes()
        {
            Locations.Clear();
            Distribuidor distribuidor = new Distribuidor
            {
                IdDistribuidor = Settings.IdDistribuidor,
            };
            var response = await ApiServices.InsertarAsync <Distribuidor>(distribuidor, new Uri(Constants.BaseApiAddress), "/api/Compras/MisVentasPendientes");

            ListaClientes = JsonConvert.DeserializeObject <List <CompraResponse> >(response.Result.ToString());
            Point p = new Point(0.48, 0.96);

            foreach (var cliente in ListaClientes)
            {
                var Pindistribuidor = new TKCustomMapPin
                {
                    Image       = "casa",
                    Position    = new TK.CustomMap.Position((double)cliente.Latitud, (double)cliente.Longitud),
                    Title       = cliente.NombreCliente + "",
                    Subtitle    = "Nro tanques: " + cliente.Cantidad,
                    Anchor      = p,
                    ShowCallout = true,
                };
                Locations.Add(Pindistribuidor);
            }
            ListaClientes.Count();
        }
        async Task ExecuteLoadLocationsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Locations.Clear();
                var locations = await DataStore.GetLocationsAsync(true);

                foreach (var location in locations)
                {
                    Locations.Add(location);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        private async Task SearchLocationAsync()
        {
            if (string.IsNullOrWhiteSpace(SearchLocationText))
            {
                return;
            }

            ShowBusy("Searching...");

            try
            {
                var address = SearchLocationText;
                var result  = await LocationService.FindLocationAsync(new GeocodeLocationRequest(SearchLocationText));

                NotBusy();

                if (result.Locations != null && result.Locations.Count > 0)
                {
                    Locations.Clear();
                    MapCenter = result.Locations[0];
                    Locations.Add(MapCenter);
                }
                else
                {
                    App.ShowMessage("Could not find location", "search");
                }
            }
            finally
            {
                NotBusy();
            }
        }
Example #4
0
        public void SetMockData(IGeolocationService geolocation)
        {
            Locations.Clear();
            void addLocation(string location)
            {
                App.InvokeOnMainThreadAsync(() =>
                                            Locations.Add(new Location(location, Locations.Count + 1, geolocation.GetAddressList(location).FirstOrDefault()))
                                            );
            }

            addLocation("Warszawa");
            addLocation("Wrocław");
            addLocation("Bydgoszcz");
            addLocation("Białystok");
            addLocation("Rzeszów");
            addLocation("Gdańsk");
            addLocation("Poznań");
            addLocation("Kraków");
            addLocation("Szczecin");
            addLocation("Lublin");
            addLocation("Katowice");
            addLocation("Łódź");
            addLocation("Koszalin");
            addLocation("Częstochowa");
            addLocation("Radom");
            addLocation("Płock");
            addLocation("Zamość");
            addLocation("Chojnice");
            addLocation("Świnoujście");
            addLocation("Słupsk");
            addLocation("Opole");
            addLocation("Zielona Góra");
            addLocation("Olsztyn");
        }
        private async Task RequestCurrentLocationAsync()
        {
            ShowBusy("Searching...");

            try
            {
                var result = await FetchCurrentLocationCommand.ExecuteAsync(null);

                Locations.Clear();
                if (result.IsValid())
                {
                    SearchLocationText = string.Empty;
                    MapCenter          = result.CurrentLocation;
                    //Locations.Add(result.CurrentLocation);
                }
                else
                {
                    App.ShowMessage(result.Notification.ToString(), "Error");
                }
            }
            finally
            {
                NotBusy();
            }
        }
        private async Task ExecuteGetLocationsCommand()
        {
            if (IsBusy || !(await LoginAsync()))
            {
                return;
            }

            //if (ForceSync)
            //Settings.LastSync = DateTime.Now.AddDays (-30);

            IsBusy = true;
            GetLocationsCommand.ChangeCanExecute();
            try{
                Locations.Clear();

                //var stores = new List<Store>();
                Geocoder geoCoder = new Geocoder();

                var locations = await azureService.GetLocations();

                foreach (var location in locations)
                {
                    if (string.IsNullOrWhiteSpace(location.Image))
                    {
                        location.Image = "http://refractored.com/images/wc_small.jpg";
                    }

                    //added by aditmer on 2/14/18 because GeoCoding fails when offline
                    if (CrossConnectivity.Current.IsConnected)
                    {
                        //geocode the street address if the data doesn't contain coordinates
                        if (location.Latitude == 0 && location.Longitude == 0)
                        {
                            var address = location.StreetAddress + ", " + location.City +
                                          ", " + location.State + ", " + location.ZipCode;
                            var approximateLocations = await geoCoder.GetPositionsForAddressAsync(address);

                            Position pos = approximateLocations.FirstOrDefault();
                            location.Latitude  = pos.Latitude;
                            location.Longitude = pos.Longitude;
                        }
                    }

                    Locations.Add(location);
                }

                Sort();
            }
            catch (Exception ex) {
                _page.DisplayAlert("Uh Oh :(", "Unable to gather locations.", "OK");
                Analytics.TrackEvent("Exception", new Dictionary <string, string> {
                    { "Message", ex.Message },
                    { "StackTrace", ex.ToString() }
                });
            }
            finally {
                IsBusy = false;
                GetLocationsCommand.ChangeCanExecute();
            }
        }
Example #7
0
 public override void DisposeModel()
 {
     BinTypes.Clear();
     Locations.Clear();
     Zones.Clear();
     base.DisposeModel();
 }
        public async void OnNavigatingTo(INavigationParameters parameters)
        {
            var data = await LocationService.GetAsync();

            Locations.Clear();
            foreach (var item in data)
            {
                Locations.Add(new Location
                {
                    Title                 = item.Title,
                    Description           = item.Description,
                    HotelName             = item.HotelName,
                    HotelStandardsTitle   = item.HotelStandardsTitle,
                    HotelStandards        = item.HotelStandards,
                    Address               = item.Address,
                    PhoneNumber           = item.PhoneNumber,
                    DirectionsFromAirport = item.DirectionsFromAirport,
                    ParkingInformation    = item.ParkingInformation,
                    LocalAttractionsTitle = item.LocalAttractionsTitle,
                    LocalAttractions      = item.LocalAttractions,
                    Image                 = item.Image,
                    LearnMoreUrl          = item.LearnMoreUrl,
                    BookNowUrl            = item.BookNowUrl,
                    PhoneNumberUrl        = item.PhoneNumberUrl,
                    WebsiteUrl            = item.WebsiteUrl,
                    MapUrl                = item.MapUrl,
                    WebsiteName           = item.WebsiteName
                });
            }
            Pages = Locations;
        }
Example #9
0
        private async void FirePlacesSearch(Task <WebServiceResults.Result> getResult, CancellationTokenSource onCancel)
        {
            try
            {
                WebServiceResults.Result result = await Task.Run(() => getResult, onCancel.Token);

                if (result != null)
                {
                    Locations.Clear();

                    foreach (var prediction in result.predictions.Where(newItem => Locations.All(oldItem => oldItem.Id != newItem.id)))
                    {
                        Locations.Add(new PlaceLocation()
                        {
                            Id       = prediction.place_id,
                            Location = prediction.description
                        });
                    }
                }
            }

            catch (TaskCanceledException ex)
            {
            }
        }
        async Task ExecuteLoadItemsCommand()
        {
            IsBusy = true;

            try
            {
                Locations.Clear();
                var locations = await _ufavLocationService.GetMyLocationsAsync();

                var items = locations.Select(x => x.ToLocationRequest());

                foreach (var item in items)
                {
                    Locations.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        public async void SeguirA()
        {
            if (Settings.IdDistribuidor != 0)
            {
                var distribuidor = new Distribuidor
                {
                    IdDistribuidor = Settings.IdDistribuidor,
                };
                Point p = new Point(0.48, 0.96);


                var response = await ApiServices.InsertarAsync <Distribuidor>(distribuidor, new Uri(Constants.BaseApiAddress), "/api/Rutas/GetLastPosition");

                var ruta = JsonConvert.DeserializeObject <Ruta>(response.Result.ToString());

                Locations.Clear();

                Locations.Add(new TKCustomMapPin
                {
                    Image       = "camion.png",
                    Position    = new TK.CustomMap.Position((double)ruta.Latitud, (double)ruta.Longitud),
                    Anchor      = p,
                    ShowCallout = true,
                });
                CenterSearch = (MapSpan.FromCenterAndRadius((new TK.CustomMap.Position((double)ruta.Latitud, (double)ruta.Longitud)), Distance.FromMiles(.5)));
            }
        }
Example #12
0
        private async void Buy()
        {
            var lat = CenterSearch.Center.Latitude;
            var lon = CenterSearch.Center.Longitude;

            CenterSearch = (MapSpan.FromCenterAndRadius((new TK.CustomMap.Position(lat, lon)), Distance.FromMiles(.10)));

            Locations.Clear();
            Camiones.Clear();

            Locations.Add(new TKCustomMapPin
            {
                Image       = "casa",
                Position    = CenterSearch.Center,
                Anchor      = new Point(0.48, 0.96),
                ShowCallout = true,
            });



            ObtenerDireccion(CenterSearch.Center.Latitude, CenterSearch.Center.Longitude);

            isVisible = true;
            OneButton = false;
        }
Example #13
0
        // TODO: refresh one item only
        public async void Refresh(LocationViewModel item = null)
        {
            Operation = Resources.Loading;
            try
            {
                var locations = Locations.Select(it => it.Location).ToList();
                Locations.Clear();
                foreach (var location in locations)
                {
                    var data = await _reader.ReadDataAsync(location);

                    if (data != null)
                    {
                        Locations.Add(new LocationViewModel(location, data));
                    }
                }
                Operation = Resources.Ready;
                var first = Locations.FirstOrDefault();
                if (first != null)
                {
                    _eventAggregator.PublishEvent(new UpdateTrayIconTextEvent()
                    {
                        Text = first.BriefText
                    });
                }
            }
            catch (Exception e)
            {
                Operation = e.Message;
            }
        }
Example #14
0
        public ObservableCollection <LocationSearchResultItem> GetLocations()
        {
            var i = 0;

            var res     = _index.Search(new Query("food"));
            var count   = res.Count;
            var results = JsonConvert.DeserializeObject <List <LocationSearchResultItem> >(res["hits"].ToString());


            LocationSearchResultItems = new ObservableCollection <LocationSearchResultItem>();

            var locations = new List <LocationSearchResultItem>
            {
                new LocationSearchResultItem {
                    Name = "Location 1", Description = "Description for location 1"
                },
                new LocationSearchResultItem {
                    Name = "Location 2", Description = "Description for location 2"
                }
            };

            Locations.Clear();

            foreach (var location in results)
            {
                i++;
                location.Index = i;
                LocationSearchResultItems.Add(location);
            }

            return(LocationSearchResultItems);
        }
Example #15
0
        public async Task Load()
        {
            if (NotNetOrConnection)
            {
                return;
            }

            try
            {
                LocationsIsBeingLoaded = true;
                List <Location> locations = await NAV.GetLocationList("", false, 1, int.MaxValue, ACD.Default).ConfigureAwait(true);

                Locations.Clear();
                foreach (Location location in locations)
                {
                    Locations.Add(location);
                }

                if (CanChangeLocationCode)
                {
                    LocationsIsLoaded = locations.Count > 0;
                }
                else
                {
                    LocationsIsLoaded = false;
                }
                MessagingCenter.Send <ZoneViewModel>(this, "LocationsIsLoaded");



                BinTypesIsBeingLoaded = true;
                List <BinType> bintypes = await NAV.GetBinTypeList(1, int.MaxValue, ACD.Default).ConfigureAwait(true);

                BinTypes.Clear();
                foreach (BinType bt in bintypes)
                {
                    BinTypes.Add(bt);
                }
                BinTypesIsLoaded = bintypes.Count > 0;
                MessagingCenter.Send <ZoneViewModel>(this, "BinTypesIsLoaded");
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                State     = ModelState.Error;
                ErrorText = e.Message;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                State     = ModelState.Error;
                ErrorText = e.Message;
            }
            finally
            {
                BinTypesIsBeingLoaded  = false;
                LocationsIsBeingLoaded = false;
            }
        }
Example #16
0
 public async Task Init(string user, string password)
 {
     this.User     = user;
     this.Password = password;
     Locations.Clear();
     await Login();
     await UserAccount();
     await RefreshSetup();
     await UpdateStatus();
 }
 public PinItemsSourcePageViewModel(INavService navService, IAnalyticsService analyticsService)
     : base(navService,
            analyticsService)
 {
     AddLocationCommand     = new Command(AddLocation);
     RemoveLocationCommand  = new Command(RemoveLocation);
     ClearLocationsCommand  = new Command(() => Locations.Clear());
     UpdateLocationsCommand = new Command(UpdateLocations);
     ReplaceLocationCommand = new Command(ReplaceLocation);
 }
        private async void  GetLocationsAsync()
        {
            Locations.Clear();
            var locations = await WeatherAPI.GetLocationKeyAsync(query);

            foreach (Location location in locations)
            {
                Locations.Add(location);
            }
        }
Example #19
0
 private async void AddLocation()
 {
     MainVM.Loading = true;
     if (AddingLocationName != "" && !double.IsNaN(FavAddressSearch.SelectedAddress?.Lat ?? double.NaN))
     {
         if (Editing == null)
         {
             if (await Client.AddAddress(FavAddressSearch.SelectedAddress, AddingLocationName))
             {
                 Locations.Add(new UserLocation(AddingLocationName, FavAddressSearch.SelectedAddress));
                 AddingLocationName = "";
                 FavAddressSearch.SelectedAddress     = null;
                 FavAddressSearch.SelectedAddressText = "";
                 FavAddressSearch.Addresses.Clear();
             }
         }
         else
         {
             if (Editing.Address == FavAddressSearch.SelectedAddress && Editing.Name == AddingLocationName)
             {
                 Editing            = null;
                 AddingLocationName = "";
                 FavAddressSearch.SelectedAddress     = null;
                 FavAddressSearch.SelectedAddressText = "";
                 FavAddressSearch.Addresses.Clear();
             }
             else
             {
                 if (await Client.EditAddress(Editing.Name, AddingLocationName, FavAddressSearch.SelectedAddress))
                 {
                     Editing            = null;
                     AddingLocationName = "";
                     FavAddressSearch.SelectedAddress     = null;
                     FavAddressSearch.SelectedAddressText = "";
                     FavAddressSearch.Addresses.Clear();
                     await Task.Run(async() =>
                     {
                         return(await Client.GetMyAddresses());
                     }).ContinueWith(task =>
                     {
                         Locations.Clear();
                         Locations.AddRange(task.Result);
                         MainVM.Loading = false;
                     }, TaskScheduler.FromCurrentSynchronizationContext());
                 }
             }
         }
     }
     else
     {
         Editing = null;
         FavAddressSearch.Addresses.Clear();
     }
     MainVM.Loading = false;
 }
Example #20
0
        public virtual void Reset()
        {
            Dispose();

            Head = new CacheFileHeader(Head);

            DebugStrings = new Util.StringPool(true);
            RamMemory    = new BlamLib.IO.EndianWriter(new System.IO.MemoryStream(1024), this);

            Locations.Clear();
        }
Example #21
0
        public MapViewModel(List <ComplainRequest> _ListDenuncia)
        {
            Locator();
            locations = new ObservableCollection <TKCustomMapPin>();
            Locations.Clear();
            _listdenuncia = new List <ComplainRequest>();
            ListDenuncia.Clear();
            foreach (var denuncia in _ListDenuncia)
            {
                ListDenuncia.Add(denuncia);

                var cachedImage = new CachedImage()
                {
                    HorizontalOptions    = LayoutOptions.FillAndExpand,
                    VerticalOptions      = LayoutOptions.FillAndExpand,
                    DownsampleToViewSize = true,

                    Transformations = new System.Collections.Generic.List <ITransformation>()
                    {
                        new GrayscaleTransformation(),
                        new CircleTransformation(),
                    },
                    Source    = denuncia.Photo,
                    CacheType = FFImageLoading.Cache.CacheType.Disk
                };
                string imagenPin = "";
                Color  colorpin  = Color.White;
                if (denuncia.IdSubcategory < 3)
                {
                    imagenPin = "qpt_mov";
                    colorpin  = Color.Blue;
                }
                else if (denuncia.IdSubcategory < 6)
                {
                    imagenPin = "qpt_edu";
                    colorpin  = Color.Red;
                }
                else if (denuncia.IdSubcategory < 9)
                {
                    imagenPin = "qpt_inc";
                    colorpin  = Color.Yellow;
                }
                var pin = new TKCustomMapPin
                {
                    Position        = new TK.CustomMap.Position((double)denuncia.Latitude, (double)denuncia.Longitude),
                    Title           = denuncia.Title,
                    Subtitle        = denuncia.Description,
                    DefaultPinColor = colorpin,
                    ShowCallout     = true,
                };

                Locations.Add(pin);
            }
        }
Example #22
0
 public void InitBlank()
 {
     LastModified.Reset();
     Locations.Clear();
     Notes.Clear();
     Tags.Clear();
     TagMaps.Clear();
     BlockRanges.Clear();
     Bookmarks.Clear();
     UserMarks.Clear();
 }
        private void Cleanup()
        {
            Locations.CollectionChanged -= Locations_CollectionChanged;
            Locations.Clear();

            AddLocationCommand    = null;
            RemoveLocationCommand = null;
            Status = null;

            _messengerService  = null;
            _collectionManager = null;
        }
Example #24
0
        public async Task RefreshSetup()
        {
            var info = await MakeGetRequest <Location[]>(string.Format(Controller.RootUrl + "/WebAPI/emea/api/v1/location/installationInfo?userId={0}&includeTemperatureControlSystems=True", AccountInfo.UserId));

            foreach (var loc in info)
            {
                loc.Controller = this;
            }
            Locations.Clear();
            Locations.AddRange(info);
            await UpdateStatus();
        }
Example #25
0
 public override void Clear()
 {
     Broadcasts.Clear();
     Locations.Clear();
     Restrictions.Clear();
     Rewards.Clear();
     Rules.Clear();
     Sounds.Clear();
     SuddenDeath.Clear();
     Timing.Clear();
     Weather.Clear();
 }
Example #26
0
 private void loadWorldLocationWidgets()
 {
     Locations.Clear();
     foreach (var country in WorldData.Countries)
     {
         foreach (var place in country.Places)
         {
             var btn = new WorldLocationWidget(this, place);
             btn.OnClick += Btn_OnClick;
             Locations.Add(btn);
         }
     }
 }
Example #27
0
 private void ExecuteFindPlaceCommandAsync(string searchString)
 {
     if (searchString?.Length >= 3)
     {
         IsVisibleListView = true;
         PerformSearch();
     }
     else
     {
         IsVisibleListView = false;
         Locations.Clear();
     }
 }
        public void PopulateGame()
        {
            var id = OlympiadId;

            if (id == 0)
            {
                YearOf    = "";
                Number    = "";
                Title     = ""; Venue = ""; StartDate = null; FinishDate = null; MaxFee = ""; MaxCon = ""; AgeDate = null;
                JnrAge    = ""; SnrAge = "";
                PentaLong = ""; PentaTotal = "";
                Events.Clear();
                Locations.Clear();
            }
            else
            {
                var context = DataEntitiesProvider.Provide();
                // TODO This join could be eliminated if an Event had a do-not-delete flag. Still, it's
                // better than not Including it.
                var o = context.Olympiad_Infoes.Include("Events").Include("Events.Entrants")
                        .FirstOrDefault(x => x.Id == id);
                EditingThePast = !o.Current;
                YearOf         = o.YearOf.ToString();
                Number         = o.Number;
                Title          = o.Title;
                Venue          = o.Venue;
                StartDate      = o.StartDate;
                FinishDate     = o.FinishDate;
                MaxFee         = (o.MaxFee.HasValue) ? o.MaxFee.Value.ToString("F2") : "";
                MaxCon         = (o.MaxCon.HasValue) ? o.MaxCon.Value.ToString("F2") : "";
                AgeDate        = o.AgeDate;
                JnrAge         = o.JnrAge.ToString();
                SnrAge         = o.SnrAge.ToString();
                PentaLong      = o.PentaLong.ToString();
                PentaTotal     = o.PentaTotal.ToString();
                Events.Clear();
                foreach (var e in o.Events.OrderBy(x => x.Code))
                {
                    Events.Add(new EventVm(e));
                }
                Locations.Clear();
                foreach (var l in o.Locations.OrderBy(x => x.Location1))
                {
                    Locations.Add(new LocationVm()
                    {
                        Id = l.Id, Name = l.Location1
                    });
                }
            }
            IsDirty = false;
        }
        public async void SearchLocations(GeoLocation centerLocation, string searchTerm)
        {
            LocationService locationService = new LocationService();

            Locations.Clear();
            var locationResults = await locationService.GetLocations(centerLocation, searchTerm);

            //var bestLocationResults = locationResults.Where(location => location.Rank > 80);
            //foreach (var item in bestLocationResults)
            foreach (var item in locationResults)
            {
                Locations.Add(item);
            }
        }
Example #30
0
        private async Task LoadLocationsList()
        {
            List <Location> locations = await NAV.GetLocationList("", false, 1, int.MaxValue, ACD.Default).ConfigureAwait(true);

            if (!IsDisposed)
            {
                Locations.Clear();
                foreach (Location location in locations)
                {
                    Locations.Add(location);
                }
                LocationsIsLoaded = CanChangeLocationAndZone && locations.Count > 0;
            }
        }