public override void ViewDidLoad() { base.ViewDidLoad(); viewModel = new CoffeesViewModel(); MyButtonLoadData.TouchUpInside += async(sender, args) => { MyButtonLoadData.Enabled = false; MyMap.RemoveAnnotations(MyMap.Annotations); var coffees = await viewModel.GetCoffees(); foreach (var coffee in coffees) { MyMap.AddAnnotation(new MKPointAnnotation { Coordinate = new CLLocationCoordinate2D(coffee.Latitude, coffee.Longitude), Title = coffee.Name }); } MyButtonLoadData.Enabled = true; }; ZoomToSeattle(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); viewModel = new CoffeesViewModel(); handler = new Handler(); mapFragment = FragmentManager.FindFragmentById <MapFragment>(Resource.Id.map); addPin = FindViewById <Button>(Resource.Id.button_add_pin); loadCoffee = FindViewById <Button>(Resource.Id.button_load_coffee); addPin.Enabled = loadCoffee.Enabled = false; mapFragment.GetMapAsync(this); addPin.Click += AddPin_Click; loadCoffee.Click += LoadCoffee_Click; }
public async Task <IActionResult> CoffeesMenu() { var model = new CoffeesViewModel(); var coffeesDBO = await _coffeeRepository.SelectAllCoffee(); model.Coffees = coffeesDBO.Select(coffeeDBO => coffeeDBO).ToList(); return(View(model)); }
public IActionResult Coffees() { var model = new CoffeesViewModel(); var coffeesDBO = _coffeeRepository.SelectAllCoffee(); model.Coffees = coffeesDBO.Select(coffeeDBO => coffeeDBO.Name).ToList(); return(View(model)); }
public IActionResult Coffees() { var model = new CoffeesViewModel(); if (_memoryCache.TryGetValue("coffees", out ICollection <string> coffees)) { model.Coffees = coffees; } return(View(model)); }
public IActionResult Coffees() { var model = new CoffeesViewModel(); model.Coffees = _coffeeRepository.SelectAllCoffees() .Select(dbo => new CoffeeNameAndId { Name = dbo.Name, ID = dbo.ID }) .ToList(); return(View(model)); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); viewModel = new CoffeesViewModel(); viewModel.PropertyChanged += ViewModel_PropertyChanged; viewModel.Places.CollectionChanged += Places_CollectionChanged; //Setup UI here query = FindViewById <EditText>(Resource.Id.edittext_query); searchButton = FindViewById <Button>(Resource.Id.button_search); progress = FindViewById <ProgressBar>(Resource.Id.progressbar_loading); loadButton = FindViewById <Button>(Resource.Id.button_load); saveButton = FindViewById <Button>(Resource.Id.button_save); //normal click handlers here. loadButton.Click += LoadButton_Click; saveButton.Click += SaveButton_Click; //Click events can be done in line with lambdas searchButton.Click += async(sender, args) => { if (map == null) { return; } var center = map.CameraPosition.Target; await viewModel.SearchForPlaces(center.Latitude, center.Longitude, query.Text); }; //load map mapFragment = FragmentManager.FindFragmentById <MapFragment>(Resource.Id.map); mapFragment.GetMapAsync(this); UserDialogs.Init(this); }
public async Task <IActionResult> Coffees() { var model = new CoffeesViewModel(); var CoffeeDBOList = await _coffeeRepository.SelectAllCoffee(); model.Coffees = CoffeeDBOList .Select(coffeeDBO => new CoffeeNameAndID() { Name = coffeeDBO.Name, ID = coffeeDBO.ID }) .ToList(); return(View(model)); }
public async Task <ActionResult> Index() { var itemsTask = client.GetItemsAsync <Coffee>( new EqualsFilter("system.type", "coffee"), new OrderParameter("elements.product_name"), new ElementsParameter(Coffee.ImageCodename, Coffee.PriceCodename, Coffee.ProductStatusCodename, Coffee.ProductNameCodename, Coffee.UrlPatternCodename), new DepthParameter(0) ); var processingTask = client.GetTaxonomyAsync(Coffee.ProcessingCodename); var statusTask = client.GetTaxonomyAsync(Coffee.ProductStatusCodename); var model = new CoffeesViewModel { Items = (await itemsTask).Items, Filter = new CoffeesFilterViewModel { AvailableProcessings = GetTaxonomiesAsSelectList(await processingTask), AvailableProductStatuses = GetTaxonomiesAsSelectList(await statusTask) } }; return(View(model)); }
public override void ViewDidLoad() { base.ViewDidLoad(); MyMap.WeakDelegate = this; ButtonLoad.Hidden = true; ButtonSave.Hidden = true; viewModel = new CoffeesViewModel(); viewModel.PropertyChanged += ViewModel_PropertyChanged; viewModel.Places.CollectionChanged += Places_CollectionChanged; ButtonSearch.TouchUpInside += ButtonSearch_TouchUpInside; ButtonLoad.TouchUpInside += ButtonLoad_TouchUpInside; ButtonSave.TouchUpInside += ButtonSave_TouchUpInside; var coords = new CLLocationCoordinate2D(App.StartLat, App.StartLong); var span = new MKCoordinateSpan(DistanceUtils.MilesToLatitudeDegrees(10), DistanceUtils.MilesToLongitudeDegrees(10, coords.Latitude)); MyMap.Region = new MKCoordinateRegion(coords, span); }
public IActionResult InsertCoffee() { var model = new CoffeesViewModel(); return(View(model)); }
public CoffeesPage() { InitializeComponent(); BindingContext = new CoffeesViewModel(); }