public override void ViewDidLoad() { base.ViewDidLoad(); var source = new MvxSimpleTableViewSource(News, NewsCell.Key); var set = this.CreateBindingSet <NewsView, NewsViewModel>(); set.Bind(source).To("Articles"); set.Bind(source).For(v => v.SelectionChangedCommand).To("OpenNewsDetails"); set.Apply(); News.Source = source; News.TableFooterView = new UIView(new CoreGraphics.CGRect(0, 0, 0, 9f)); UILocalNotification notification = new UILocalNotification(); notification.FireDate = NSDate.FromTimeIntervalSinceNow(15); //notification.AlertTitle = "Alert Title"; // required for Apple Watch notifications notification.AlertAction = "View Alert"; notification.AlertTitle = "Happy birthday" + MyAnimalsViewModel.GetAnimalName() + "!"; notification.AlertBody = MyAnimalsViewModel.GetAnimalName() + " just got 2 years old. Check out his activity now!"; UILocalNotification notification2 = new UILocalNotification(); notification2.FireDate = NSDate.FromTimeIntervalSinceNow(30); //notification.AlertTitle = "Alert Title"; // required for Apple Watch notifications notification2.AlertAction = "View Alert"; notification2.AlertTitle = MyAnimalsViewModel.GetAnimalName() + " flown 6 miles today."; notification2.AlertBody = "How many miles did you walk today?"; UIApplication.SharedApplication.ScheduleLocalNotification(notification); UIApplication.SharedApplication.ScheduleLocalNotification(notification2); }
private void AdoptButton_TouchDown(object sender, EventArgs e) { //Create Alert var okCancelAlertController = UIAlertController.Create("Do you want to adopt?", "For a short amount of $200 you can adopt this animal.", UIAlertControllerStyle.Alert); //Add Actions okCancelAlertController.AddAction(UIAlertAction.Create("Adopt", UIAlertActionStyle.Default, alert => { Console.WriteLine("Okay was clicked"); selectedAnimal.Owner = "JunctionX"; MyAnimalsViewModel.AddAnimal(selectedAnimal); if (selectedAnimal.Owner == null || selectedAnimal.Owner == "") { AdoptView.Hidden = true; ButtonsView1.Hidden = false; ButtonsView2.Hidden = true; } else { AdoptView.Hidden = false; ButtonsView1.Hidden = true; ButtonsView2.Hidden = false; } OwnerLabel.Text = selectedAnimal.Owner; })); okCancelAlertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, alert => Console.WriteLine("Cancel was clicked"))); //Present Alert PresentViewController(okCancelAlertController, true, null); }
public ActionResult AnimalsUpdate([DataSourceRequest]DataSourceRequest request, MyAnimalsViewModel model) { if (ModelState.IsValid && model != null) { var updated = AutoMapper.Mapper.Map<Animal>(model); updated.OrganizationId = User.Identity.GetUserId(); var updatedmodel = this.animals .UpdateAnimal(updated) .ProjectTo<MyAnimalsViewModel>() .FirstOrDefault(); } return Json(new[] { model }.ToDataSourceResult(request, ModelState)); }
private async Task LoadAnimals() { try { Items.Value = await backend.GetAnimals(); if (Items.Value != null && !animalLoaded) { foreach (var item in Items.Value) { if (item.Owner == "JunctionX") { MyAnimalsViewModel.AddAnimal(item); } } animalLoaded = true; } } catch (Exception e) { Console.WriteLine(e); } }
public ActionResult AnimalsUpdate([DataSourceRequest] DataSourceRequest request, MyAnimalsViewModel model) { if (ModelState.IsValid && model != null) { var updated = AutoMapper.Mapper.Map <Animal>(model); updated.OrganizationId = User.Identity.GetUserId(); var updatedmodel = this.animals .UpdateAnimal(updated) .ProjectTo <MyAnimalsViewModel>() .FirstOrDefault(); } return(Json(new[] { model }.ToDataSourceResult(request, ModelState))); }
public ActionResult AnimalsDestroy([DataSourceRequest] DataSourceRequest request, MyAnimalsViewModel model) { this.animals.DeleteAnimal(model.Id); return(Json(new[] { model }.ToDataSourceResult(request, ModelState))); }
public ActionResult AnimalsDestroy([DataSourceRequest]DataSourceRequest request, MyAnimalsViewModel model) { this.animals.DeleteAnimal(model.Id); return Json(new[] { model }.ToDataSourceResult(request, ModelState)); }