public PeriodicCellPlaceholder(RectangleF frame, Element element)
     : base(frame, element)
 {
     this.lblName.Hidden = true;
     this.lblAtomicNumber.Hidden = true;
     this.lblSymbol.AdjustsFontSizeToFitWidth = true;
     this.lblSymbol.Alpha = 0.6f;
 }
Ejemplo n.º 2
0
        public PeriodicCell(RectangleF frame, Element element)
            : base(frame)
        {
            this.Element = element;
            this.BackgroundColor = CellBackgroundColor;

            lblAtomicNumber = new PTLabel()
            {
                Text = this.Element.AtomicNumber.ToString(),
                TextColor = UIColor.White,
                BackgroundColor = UIColor.Clear
            };

            lblSymbol = new PTLabel()
            {
                Text = this.Element.Symbol,
                TextColor = UIColor.White,
                TextAlignment = UITextAlignment.Center,
                BackgroundColor = this.BackgroundColor
            };

            lblName = new PTLabel()
            {
                Text = this.Element.Name,
                TextColor = UIColor.White,
                TextAlignment = UITextAlignment.Center,
                AdjustsFontSizeToFitWidth = true,
                BackgroundColor = UIColor.Clear
                //BackgroundColor = UIColor.Red
            };

//            lblWeight = new PTLabel()
//            {
//                Text = this.Element.AtomicWeight,
//                AdjustsFontSizeToFitWidth = true
//            };

            Add(lblSymbol);
            Add(lblAtomicNumber);
            Add(lblName);
//            Add(lblWeight);

            this.TouchDragEnter += (object sender, EventArgs e) => {
                HighlightCell();
            };

            this.TouchDown += (object sender, EventArgs e) => {
                HighlightCell();
            };
            this.TouchDragExit += (object sender, EventArgs e) => {
                UnhighlightCell();
            };
            this.TouchUpInside += (object sender, EventArgs e) => {
                UnhighlightCell();
            };
        }
 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(); }
     );
 }