protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); RefreshButton.SetCommand(Vm.RefreshCommand); // Saving the binding to avoid garbage collection _bindings.Add(this.SetBinding( () => Vm.LastLoadedFormatted, () => LastLoadedText.Text)); _adapter = Vm.Flowers.GetRecyclerAdapter( BindViewHolder, Resource.Layout.FlowerTemplate, OnItemClick); FlowersList.SetLayoutManager(new LinearLayoutManager(this)); FlowersList.SetAdapter(_adapter); // Subscribing to events to avoid linker issues in release mode --------------------------------- // This "fools" the linker into believing that the events are used. // In fact we don't even subscribe to them. // See https://developer.xamarin.com/guides/android/advanced_topics/linking/ if (_falseFlag) { RefreshButton.Click += (s, e) => { }; } }
public Flower GetFlowerById(int flowerId) { return(FlowersList.FirstOrDefault(x => x.FlowerId == flowerId)); }
public bool DeleteFlower(Flower flower) { FlowersList.Remove(flower); return(true); }
public bool AddFlower(Flower flower) { FlowersList.Add(flower); return(true); }