public virtual void FormatSection(PFormSection section) { if (!IsViewLoaded) { return; } var si = sections.IndexOf(section); if (si < 0) { return; } try { var ds = (FormSource)TableView.Source; for (int row = 0; row < section.Items.Count; row++) { var item = section.Items [row]; if (TableView.CellAt(NSIndexPath.FromRowSection(row, si)) is PFormCell c) { try { c.Format(section, item); } catch (Exception ex) { Debug.WriteLine(ex); } } } } catch (Exception ex) { Debug.WriteLine(ex); } }
public virtual void ReloadAll(PFormSection section) { if (!IsViewLoaded) { return; } TableView.ReloadData(); }
public virtual void ReloadSection(PFormSection section) { if (!IsViewLoaded) { return; } var si = sections.IndexOf(section); if (si < 0) { return; } TableView.ReloadData(); //.ReloadSections (NSIndexSet.FromIndex (si), UITableViewRowAnimation.Automatic); }
public TranslateForm(List <Contrib> contribs) : base("Help Translate".Localize()) { var github = new PFormSection { Hint = "GitHub is used to coordinate the translation effort.".Localize(), Items = { new OpenUrlCommand("Translations on Github", "https://github.com/praeclarum/CircuitTranslations") }, }; var people = new PFormSection { Title = "Contributors".Localize(), Hint = "Thank you for your help!".Localize() }; foreach (var c in contribs) { people.Items.Add(c.Name); } Sections.Add(github); Sections.Add(people); }
public void Format(PFormSection section, object item) { var cell = this; var theme = Theme.Current; theme.Apply(cell); if (useBlur) { BackgroundColor = theme.TableCellBackgroundColor.ColorWithAlpha(0.5f); } var itemTitle = section.GetItemTitle(item); cell.TextLabel.Text = itemTitle; cell.TextLabel.AccessibilityLabel = itemTitle; cell.TextLabel.BackgroundColor = UIColor.Clear; var display = section.GetItemDisplay(item); if (display != PFormItemDisplay.Title) { cell.DetailTextLabel.Text = section.GetItemDetails(item) ?? ""; if (display == PFormItemDisplay.TitleAndValue) { cell.DetailTextLabel.TextColor = UIApplication.SharedApplication.KeyWindow.TintColor; } } var imageUrl = section.GetItemImage(item); if (string.IsNullOrEmpty(imageUrl)) { cell.ImageView.Image = null; } else { UIImage image; if (!imageCache.TryGetValue(imageUrl, out image)) { image = UIImage.FromBundle(imageUrl); imageCache.Add(imageUrl, image); } cell.ImageView.Image = image; } if (section.GetItemChecked(item)) { cell.Accessory = UITableViewCellAccessory.Checkmark; theme.ApplyChecked(cell); } else { cell.Accessory = section.GetItemNavigates(item) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None; } if (section.GetItemEnabled(item)) { var cmd = item as Command; if (cmd != null) { theme.ApplyCommand(cell); } cell.SelectionStyle = UITableViewCellSelectionStyle.Blue; } else { cell.TextLabel.TextColor = UIColor.LightGray; cell.SelectionStyle = UITableViewCellSelectionStyle.None; } }
public void FormatCell (PFormCell cell, PFormSection section, object item) { var theme = Theme.Current; theme.Apply (cell); var itemTitle = section.GetItemTitle (item); cell.TextLabel.Text = itemTitle; cell.TextLabel.AccessibilityLabel = itemTitle; cell.TextLabel.BackgroundColor = UIColor.Clear; var display = section.GetItemDisplay (item); if (display != PFormItemDisplay.Title) { cell.DetailTextLabel.Text = section.GetItemDetails (item) ?? ""; if (display == PFormItemDisplay.TitleAndValue) { cell.DetailTextLabel.TextColor = UIApplication.SharedApplication.KeyWindow.TintColor; } } var imageUrl = section.GetItemImage (item); if (string.IsNullOrEmpty (imageUrl)) { cell.ImageView.Image = null; } else { UIImage image; if (!imageCache.TryGetValue (imageUrl, out image)) { image = UIImage.FromBundle (imageUrl); imageCache.Add (imageUrl, image); } cell.ImageView.Image = image; } if (section.GetItemChecked (item)) { cell.Accessory = UITableViewCellAccessory.Checkmark; theme.ApplyChecked (cell); } else { cell.Accessory = section.GetItemNavigates (item) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None; } if (section.GetItemEnabled (item)) { var cmd = item as Command; if (cmd != null) { theme.ApplyCommand (cell); } cell.SelectionStyle = UITableViewCellSelectionStyle.Blue; } else { cell.TextLabel.TextColor = UIColor.LightGray; cell.SelectionStyle = UITableViewCellSelectionStyle.None; } }
public virtual void FormatSection (PFormSection section) { if (!IsViewLoaded) return; var si = sections.IndexOf (section); if (si < 0) return; try { var ds = (FormSource)TableView.Source; for (int row = 0; row < section.Items.Count; row++) { var item = section.Items [row]; var c = TableView.CellAt (NSIndexPath.FromRowSection (row, si)) as PFormCell; if (c != null) { try { ds.FormatCell (c, section, item); } catch (Exception ex) { Debug.WriteLine (ex); } } } } catch (Exception ex) { Debug.WriteLine (ex); } }
public virtual void ReloadSection (PFormSection section) { if (!IsViewLoaded) return; var si = sections.IndexOf (section); if (si < 0) return; TableView.ReloadData ();//.ReloadSections (NSIndexSet.FromIndex (si), UITableViewRowAnimation.Automatic); }