public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell("PopoverPageModeIdentifier"); try { if (cell == null) { cell = new CustomCell(UITableViewCellStyle.Default, "PopoverPageModeIdentifier"); } cell.Accessory = UITableViewCellAccessory.None; cell.SelectionStyle = UITableViewCellSelectionStyle.Default; if (indexPath.Row == 0) { cell.TextLabel.Text = StringRef.Single; cell.ImageView.Image = UIImage.FromBundle("Assets/Icons/page_single.png"); if (Settings.PageMode == StringRef.Single) { cell.AccessoryView = eBriefingAppearance.Checkmark; } else { cell.AccessoryView = null; } } else { cell.TextLabel.Text = StringRef.Double; cell.ImageView.Image = UIImage.FromBundle("Assets/Icons/page_double.png"); if (Settings.PageMode == StringRef.Double) { cell.AccessoryView = eBriefingAppearance.Checkmark; } else { cell.AccessoryView = null; } } } catch (Exception ex) { Logger.WriteLineDebugging("PopoverPageModeDataSource - GetCell: {0}", ex.ToString()); } return(cell); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell("PopoverCollectionIdentifier"); try { if (cell == null) { cell = new CustomCell(UITableViewCellStyle.Default, "PopoverCollectionIdentifier"); } cell.Accessory = UITableViewCellAccessory.None; cell.SelectionStyle = UITableViewCellSelectionStyle.Default; if (indexPath.Row == 0) { cell.TextLabel.Text = "All Pages"; cell.ImageView.Image = UIImage.FromBundle("Assets/Icons/menu_allpages.png"); } else if (indexPath.Row == 1) { cell.TextLabel.Text = "Table of Contents"; cell.ImageView.Image = UIImage.FromBundle("Assets/Icons/menu_toc.png"); } else if (indexPath.Row == 2) { cell.TextLabel.Text = "Bookmarks"; cell.ImageView.Image = UIImage.FromBundle("Assets/Icons/menu_bookmarks.png"); } else if (indexPath.Row == 3) { cell.TextLabel.Text = "Notes"; cell.ImageView.Image = UIImage.FromBundle("Assets/Icons/menu_notes.png"); } else { cell.TextLabel.Text = "Annotations"; cell.ImageView.Image = UIImage.FromBundle("Assets/Icons/menu_annotations.png"); } } catch (Exception ex) { Logger.WriteLineDebugging("PopoverCollectioneDataSource - GetCell: {0}", ex.ToString()); } return(cell); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell("PrintIdentifier"); try { if (cell == null) { cell = new CustomCell(UITableViewCellStyle.Default, "PrintIdentifier"); } else { foreach (UIView subview in cell.ContentView) { if (subview.Tag == -1) { subview.RemoveFromSuperview(); } } } cell.Accessory = UITableViewCellAccessory.None; cell.SelectionStyle = UITableViewCellSelectionStyle.None; if (indexPath.Section == 0) { // Orientation if (indexPath.Row == 0) { cell.TextLabel.Text = "Portrait"; } else { cell.TextLabel.Text = "Landscape"; } if (indexPath.Row == 0) { if (parent.Orientation == PrintHelper.ORIENTATION.PORTRAIT) { cell.AccessoryView = eBriefingAppearance.Checkmark; } else { cell.AccessoryView = null; } } else { if (parent.Orientation == PrintHelper.ORIENTATION.LANDSCAPE) { cell.AccessoryView = eBriefingAppearance.Checkmark; } else { cell.AccessoryView = null; } } } else if (indexPath.Section == 1) { // Range if (indexPath.Row == 0) { cell.TextLabel.Text = "Current Page"; if (parent.Range == PrintHelper.RANGE.CURRENT) { cell.AccessoryView = eBriefingAppearance.Checkmark; } else { cell.AccessoryView = null; } } else { cell.TextLabel.Text = "Pages:"; if (parent.Range == PrintHelper.RANGE.CUSTOM) { cell.AccessoryView = eBriefingAppearance.Checkmark; } else { cell.AccessoryView = null; } cellView = new PrintRangeCellView(parent.StartPage, parent.EndPage, MAX_PRINT_RANGE); cellView.Tag = -1; cellView.Frame = new CGRect(70, 0, cellView.Frame.Width, cellView.Frame.Height); cellView.UpdateStartEvent += (nuint start) => { parent.StartPage = start; }; cellView.UpdateEndEvent += (nuint end) => { parent.EndPage = end; }; cellView.ApplyEvent += () => { parent.Range = PrintHelper.RANGE.CUSTOM; tableView.SelectRow(indexPath, true, UITableViewScrollPosition.None); tableView.ReloadData(); }; cell.ContentView.AddSubview(cellView); } } else if (indexPath.Section == 2) { cell.AccessoryView = null; // Annotations if (indexPath.Row == 0) { cell.TextLabel.Text = "Print Annotations"; if (annSwitch == null) { annSwitch = new UISwitch(); annSwitch.Frame = new CGRect(tableView.Frame.Size.Width - 20 - annSwitch.Frame.Width, 22f - (annSwitch.Frame.Height / 2f), annSwitch.Frame.Width, annSwitch.Frame.Height); annSwitch.ValueChanged += (object sender, EventArgs e) => { if (annSwitch.On) { parent.Annotation = PrintHelper.ANNOTATION.WITH; } else { parent.Annotation = PrintHelper.ANNOTATION.WITHOUT; } }; } cell.ContentView.AddSubview(annSwitch); } else { cell.TextLabel.Text = "Print Notes"; if (noteSwitch == null) { noteSwitch = new UISwitch(); noteSwitch.Frame = new CGRect(tableView.Frame.Size.Width - 20 - noteSwitch.Frame.Width, 22f - (noteSwitch.Frame.Height / 2f), noteSwitch.Frame.Width, noteSwitch.Frame.Height); noteSwitch.ValueChanged += (object sender, EventArgs e) => { if (noteSwitch.On) { parent.Note = PrintHelper.NOTE.WITH; } else { parent.Note = PrintHelper.NOTE.WITHOUT; } }; } cell.ContentView.AddSubview(noteSwitch); } } } catch (Exception ex) { Logger.WriteLineDebugging("PrintDataSource - GetCell: {0}", ex.ToString()); } return(cell); }