public void ShowDetails(Element element, RectangleF cellFrame) { cellFrame.Offset(PeriodicTable.Frame.Location); detailsView.CellFrame = cellFrame; detailsView.Frame = cellFrame; detailsView.BackgroundColor = PeriodicCell.GetBackgroundColor(element.GroupName); UIView.Animate(1.2, 0, UIViewAnimationOptions.CurveEaseInOut, () => { detailsView.Hidden = false; detailsView.Alpha = 1; detailsView.Frame = this.View.Bounds; }, () => { detailsView.SetNeedsLayout(); } ); }
public PeriodicTable(RectangleF frame, List <Element> elements) : base(frame) { this.Elements = elements.OrderBy(o => o.AtomicNumber).ToList(); Cells = new List <PeriodicCell>(); Elements.ForEach(item => { var cell = new PeriodicCell(RectangleF.Empty, item); cell.TouchUpInside += (sender, e) => { if (CellSelected != null) { CellSelected(item, cell.Frame); } }; Add(cell); Cells.Add(cell); }); PlaceholderCells = new List <PeriodicCellPlaceholder>(); var cellLanthPlaceholder = new PeriodicCellPlaceholder(RectangleF.Empty, new Element() { Symbol = "57 - 71", Group = 3, Period = 6, AtomicNumber = 57 }); Add(cellLanthPlaceholder); PlaceholderCells.Add(cellLanthPlaceholder); var cellActPlaceholder = new PeriodicCellPlaceholder(RectangleF.Empty, new Element() { Symbol = "89 - 103", Group = 3, Period = 7, AtomicNumber = 89 }); Add(cellActPlaceholder); PlaceholderCells.Add(cellActPlaceholder); }
public PeriodicTable(RectangleF frame, List<Element> elements) : base(frame) { this.Elements = elements.OrderBy(o => o.AtomicNumber).ToList(); Cells = new List<PeriodicCell>(); Elements.ForEach(item => { var cell = new PeriodicCell(RectangleF.Empty, item); cell.TouchUpInside += (sender, e) => { if (CellSelected != null) CellSelected(item, cell.Frame); }; Add(cell); Cells.Add(cell); }); PlaceholderCells = new List<PeriodicCellPlaceholder>(); var cellLanthPlaceholder = new PeriodicCellPlaceholder(RectangleF.Empty, new Element() { Symbol = "57 - 71", Group = 3, Period = 6, AtomicNumber = 57 }); Add(cellLanthPlaceholder); PlaceholderCells.Add(cellLanthPlaceholder); var cellActPlaceholder = new PeriodicCellPlaceholder(RectangleF.Empty, new Element() { Symbol = "89 - 103", Group = 3, Period = 7, AtomicNumber = 89 }); Add(cellActPlaceholder); PlaceholderCells.Add(cellActPlaceholder); }