void GetAttributeRowSelected(Attribute attrReturned) { //get the row selected from the left table //new UIAlertView("Row Selected", attrReturned.Name, null, "OK", null).Show(); if (attrReturned.Name == "All") { attributesCollectionView.ClearImages(); attributesCollectionView.UpdateImages(new DatabaseContext <Image>().GetQuery("Select * from Image")); return; } List <ImageAttributes> ImagesWithSameAttribute = new DatabaseContext <ImageAttributes>().GetQuery("SELECT * FROM ImageAttributes WHERE Name = ?", attrReturned.Name); List <Image> Images = new List <Image>(); foreach (ImageAttributes a in ImagesWithSameAttribute) { List <Image> temp = new DatabaseContext <Image>().GetQuery("Select * FROM Image WHERE ID = ?", a.ImageID.ToString()); foreach (Image i in temp) { Images.Add(i); } } if (Images != null) { attributesCollectionView.ClearImages(); attributesCollectionView.UpdateImages(Images); } //clear the attributes table RightAttributesTableSource.ClearTable(); RightImageAttributeTable.RefreshTableView(); }
void HandleTouchUpInsideLeft(object sender, EventArgs ee) { AttributesTableSource.RowDeselected(attributesTableViewController.getTable(), null); RightAttributesTableSource.ClearTable(); RightImageAttributeTable.RefreshTableView(); attributesCollectionView.ClearImages(); attributesCollectionView.UpdateImages(new DatabaseContext <Image>().GetQuery("Select * FROM Image")); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. TableSourceAttributes attrSource = new TableSourceAttributes(); AttributesTableView.Source = attrSource; OkButton.TouchUpInside += (sender, e) => { string input = AttributeInput.Text; if (input != "") { /* * Insert attribute to attributes DB. * This will keep attributes with unique values only. */ RightAttributesTable.UpdateData(input.ToString()); RightAttributesTable.SetTableSource(currentlySelectedImage.ID); ImageAttributeTable.RefreshTableView(); LeftAttributesTable.ReloadTableData(); PresentingController.DismissViewController(true, null); } else { PresentingController.DismissViewController(true, null); } }; attrSource.AttributeRowToController += (attr) => { //add the attribute to the selected image RightAttributesTable.UpdateData(attr.Name); RightAttributesTable.SetTableSource(currentlySelectedImage.ID); ImageAttributeTable.RefreshTableView(); PresentingController.DismissViewController(true, null); }; this.ViewWillLayoutSubviews(); }