Exemple #1
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            if (indexPath.Section == 0)
            {
                foreach (UITableViewCell c in tableView.VisibleCells)
                {
                    c.Accessory = UITableViewCellAccessory.None;
                }

                UITableViewCell cell = tableView.CellAt(indexPath);

                if (cell != null)
                {
                    cell.Accessory = UITableViewCellAccessory.Checkmark;
                }

                var at = BNRItemStore.allAssetTypes[indexPath.Row];
                item.assetType = at.assetType;
                BNRItemStore.updateDBItem(item);
//				if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { // Bronze, asset type picker popover for iPad
//					controller.updateAssetType(); // Bronze
//					popoverController.Dismiss(true); // Bronze
//					popoverController = null; // Bronze
//				} else { // Bronze
                this.NavigationController.PopViewController(true);
//				} // Bronze
            }
        }
        public void nudgeItemValue(HomepwnerItemCell cell, double stepperValue)
        {
            NSIndexPath indexPath = TableView.IndexPathForCell(cell);
            BNRItem     i         = BNRItemStore.allItems[indexPath.Row];

            i.valueInDollars = (int)stepperValue;
            BNRItemStore.updateDBItem(i);
            TableView.ReloadData();
        }
        public void FinishedPickingMedia(UIImagePickerController picker, NSDictionary info)
        {
            string oldKey = item.imageKey;

            // Did the item already have an image?
            if (oldKey != null)
            {
                // Delete the old image
                BNRImageStore.deleteImageForKey(oldKey);
                BNRImageStore.deleteImageForKey(oldKey + ".thumbnail");
            }


            // Get the picked picture from the event args
            UIImage image = info.ObjectForKey(UIImagePickerController.OriginalImage) as UIImage;

//			item.getThumbnailFromImage(image); // For Archive method of saving

            // Get thumbnail // For SQL saving
            UIImage thumbnailImage = item.getThumbnailFromImage(image);             // For SQL saving

            // Create a GUID string - it iknows how to create unique identifier strings
            string key = Guid.NewGuid().ToString();

            item.imageKey = key;
            BNRItemStore.updateDBItem(item);
            string thumbKey = key + ".thumbnail";             // For SQL saving

            // Store image and thumbnail in the BNRIMmageStore with this key
            BNRImageStore.setImage(image, item.imageKey);
            BNRImageStore.setImage(thumbnailImage, thumbKey);

            // Put that image onto the screen in our image view
            imageView.Image = image;

            // Take the image picker off the screen -
            // You must call this dismiss method
            //this.DismissViewController(true, null);
            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
            {
                // if on the phone, the image picker os presented modally. Dismiss it.
                this.DismissViewController(true, null);
            }
            else if (UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.Camera) && UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                this.DismissViewController(true, null);
            }
            else
            {
                // If on the iPad, the image picker is in the popover. Dismiss the popover.
                imagePickerPopover.Dismiss(true);
                imagePickerPopover = null;
            }
        }
Exemple #4
0
        public override void ViewWillDisappear(bool animated)
        {
            base.ViewWillDisappear(animated);

            // Clear first responder
            this.View.EndEditing(true);

            // "Save" changes to item
            item.itemName       = nameField.Text;
            item.serialNumber   = serialNumberField.Text;
            item.valueInDollars = Convert.ToInt32(valueField.Text);
            BNRItemStore.updateDBItem(item);
        }
        public override void ViewWillDisappear(bool animated)
        {
            base.ViewWillDisappear(animated);

            // Clear first responder
            this.View.EndEditing(true);
            if (dateField.IsFirstResponder)
            {
                dateField.ResignFirstResponder();
            }

            // "Save" changes to item
            item.itemName       = nameField.Text;
            item.serialNumber   = serialNumberField.Text;
            item.valueInDollars = Convert.ToInt32(valueField.Text);
            BNRItemStore.updateDBItem(item);
            if (this.PresentingViewController != null)
            {
                var vcs = this.PresentingViewController.ChildViewControllers;
                var ivc = vcs[0] as ItemsViewController;
                ivc.TableView.ReloadData();
            }
        }