/// <summary> /// Memory clean up code for cell. /// </summary> public void cleanCell() { _imageLst = null; CheckListItem = null; ParentController = null; GuidedTableView = null; if (imagesCollectionView != null) { foreach (var imgView in imagesCollectionView.Subviews) { if (imgView is UIImageView) { (imgView as UIImageView).Image = null; } imgView.Dispose(); imgView.RemoveFromSuperview(); } imagesCollectionView.Source = null; imagesCollectionView.Delegate = null; imagesCollectionView.DataSource = null; imagesCollectionView.WeakDelegate = null; imagesCollectionView.WeakDataSource = null; } if (ImageLst != null) { ImageLst.Clear(); } if (Source != null) { Source.Dispose(); Source = null; } }
public void UpdateCollectionImageView(List <UIImage> images) { images.Count(); if (imagesList != null) { imagesList.Clear(); imagesList = null; } if (this.punch.punchImages != null) { this.punch.punchImages.Clear(); } foreach (UIImage image in images) { this.punch.punchImages.Add(ImageToByteArray(image)); } imagesList = images; if (Source == null) { Source = new PunchDataSource(images, this); } else { Source.itemsList = images; } imagesCollectionView.DataSource = Source; imagesCollectionView.ReloadData(); }
private void LoadGuidedView() { try { if (parentController != null) { parentController.HideTakePicture(); if (this.checkListItem != null) { guidedOptionLabel.Text = checkListItem.description; if (this.checkListItem.photos != null && this.checkListItem.photos.Count > 0) { List <UIImage> currentPassImages = new List <UIImage> (); foreach (var img in this.checkListItem.photos) { var imag = ByteArrayToImage(img); if (imag != null) { currentPassImages.Add(imag); } } this.ImageLst = currentPassImages; if (Source == null) { Source = new PunchDataSource(currentPassImages, this); } else { Source.itemsList = currentPassImages; } imagesCollectionView.DataSource = Source; imagesCollectionView.ReloadData(); parentController.buttonStyleRefresh(null); } } } } catch (Exception ex) { Debug.WriteLine("Exception Occured in LoadGuidedView method due to " + ex.Message); } }
public void UpdateCollectionImageView(List <UIImage> images) { try { this.ImageLst = images; if (checkListItem != null) { checkListItem.photos = new List <byte[]> (); List <byte[]> cameraImages = new List <byte[]> (); foreach (var img in images) { byte[] task = ImageToByteArray(img); var imgArr = task; cameraImages.Add(imgArr); } foreach (var img in cameraImages) { checkListItem.photos.Add(img); } } if (Source == null) { Source = new PunchDataSource(images, this); } else { Source.itemsList = images; } imagesCollectionView.DataSource = Source; imagesCollectionView.ReloadData(); if (parentController != null) { parentController.buttonStyleRefresh(null); } } catch (Exception ex) { Debug.WriteLine("Exception Occured in UpdateCollectionImageView method due to " + ex.Message); } }
// public static PunchCell Create () // { // return (PunchCell)Nib.Instantiate (null, null) [0]; // } public void UpdateCell(InspectionViewController parentController, UITableView optionsTableView, NSIndexPath indexPath, List <Model.Punch> punchItems) { try { ResetUIView(); this.parentController = parentController; this.optionsTableView = optionsTableView; this.indexPath = indexPath; Model.Punch punchItem = punchItems.ElementAt(indexPath.Row); this.punch = punchItem; this.punchItems = punchItems; foreach (var byteImage in this.punch.punchImages) { imagesList.Add(ByteArrayToImage(byteImage)); } if (Source == null) { Source = new PunchDataSource(imagesList, this); } else { Source.itemsList = imagesList; } imagesCollectionView.DataSource = Source; imagesCollectionView.ReloadData(); //if the heading is addRow if (true == shouldInsertRow) { Model.Punch punch = new Model.Punch(); punch.punchHeading = "Item " + indexPath.Row; punchItems.Add(punch); optionsTableView.BeginUpdates(); optionsTableView.InsertRows(new NSIndexPath[] { NSIndexPath.FromRowSection(indexPath.Row, indexPath.Section) }, UITableViewRowAnimation.None); optionsTableView.EndUpdates(); } punchHeadingLabel.Font = UIFont.FromName("Helvetica", 17f); punchHeadingLabel.TextColor = UIColor.FromRGB(186, 190, 194); punchTakePicBtn.Layer.CornerRadius = 5f; punchTakePicBtn.Layer.BackgroundColor = UIColor.FromRGB(18, 74, 143).CGColor; punchTakePicBtn.Layer.BorderWidth = 0.5f; punchTakePicBtn.SetTitleColor(UIColor.White, UIControlState.Normal); punchTakePicBtn.TouchUpInside -= BtnTakePic_TouchUpInside; punchTakePicBtn.TouchUpInside += BtnTakePic_TouchUpInside; punchTextView.Layer.CornerRadius = 5f; punchTextView.Layer.BorderColor = UIColor.FromRGB(186, 190, 194).CGColor; punchTextView.Layer.BorderWidth = 0.5f; if (tap != null) { this.RemoveGestureRecognizer(tap); } tap = new UITapGestureRecognizer(); tap.AddTarget(tapAction); this.AddGestureRecognizer(tap); //punchImagesScrollView.Hidden = false; punchTakePicBtn.Hidden = false; punchTextView.Hidden = false; punchHeadingLabel.Hidden = false; int showHeadingRowNumber = indexPath.Row + 1; string headingString = "Item " + showHeadingRowNumber; punchHeadingLabel.Text = headingString; punchTextView.Text = punchItem.punchDescription; var textDelegate = new PunchTextViewDelegate(this); punchTextView.WeakDelegate = textDelegate; LoadPunchView(); shouldInsertRow = false; } catch (Exception ex) { Debug.WriteLine("Exception Occured in UpdateCell method due to " + ex.Message); } }