public async void SelectLocation(LocationAutoCompleteResult selectedLocation)
        {
            var database = new LocationsDatabase(sqlite);

            if (!database.CheckIfExists(selectedLocation))
            {
                database.InsertLocation(selectedLocation);
                Close(this);
            }
            else
            {
                if (await dialog.Show("This location has already been added", "Location Exists", "Keep Searching", "Go Back"))
                {
                    SearchTerm = string.Empty;
                    Locations.Clear();
                }
                else
                {
                    Close(this);
                }
            }
        }
Пример #2
0
 public ForecastViewModel(ISqlite sqlite)
 {
     database = new LocationsDatabase(sqlite);
     AddNewLocationCommand = new MvxCommand(() => ShowViewModel <LocationSearchViewModel>());
 }