Ejemplo n.º 1
0
        public override MonoTouch.UIKit.UITableViewCell GetCell(MonoTouch.UIKit.UITableView tv)
        {
            // try and dequeue a cell object to reuse. if one doesn't exist, create a new one
            UserGroupCell cell = tv.DequeueReusableCell(cellKey) as UserGroupCell;

            if (cell == null)
            {
                cell = new UI.CustomElements.UserGroupCell(usergroup);
            }
            cell.UpdateCell(usergroup);

            return(cell);
        }
Ejemplo n.º 2
0
        public override float GetHeightForRow(MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
        {
            if (_usedForHeight == null)
            {
                _usedForHeight = (FeedbackCellView)tableView.DequeueReusableCell(FeedbackCellView.Key);
            }

            var item = ItemAt(indexPath) as FeedbackItemViewModel;

            if (item != null)
            {
                _usedForHeight.ViewModel = item;
                _usedForHeight.SetNeedsUpdateConstraints();
                _usedForHeight.UpdateConstraintsIfNeeded();
                _usedForHeight.Bounds = new System.Drawing.RectangleF(0, 0, tableView.Bounds.Width, tableView.Bounds.Height);
                _usedForHeight.SetNeedsLayout();
                _usedForHeight.LayoutIfNeeded();
                return(_usedForHeight.ContentView.SystemLayoutSizeFittingSize(MonoTouch.UIKit.UIView.UILayoutFittingCompressedSize).Height + 1);
            }

            return(base.GetHeightForRow(tableView, indexPath));
        }
Ejemplo n.º 3
0
        public override MonoTouch.UIKit.UITableViewCell GetCell(MonoTouch.UIKit.UITableView tv)
        {
            var cell = tv.DequeueReusableCell(CellKey);

            if (cell == null)
            {
                if (_full)
                {
                    cell = GistDetailViewCell.Create();
                }
                else
                {
                    cell = GistDetailViewCell.CreateNoBottom();
                }

                cell.BackgroundView = new CellBackgroundView();
            }

            cell.SelectionStyle = (Tapped != null) ? UITableViewCellSelectionStyle.Blue : UITableViewCellSelectionStyle.None;
            cell.Accessory      = (Tapped != null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None;

            var gcell = cell as GistDetailViewCell;

            if (gcell == null)
            {
                return(cell);
            }


            var str = string.IsNullOrEmpty(_gist.Description) ? "No Description" : _gist.Description;

            //We prefer the filename, so lets try and get it if it exists
            string filename = null;

            if (_gist.Files.Count > 0)
            {
                var iter = _gist.Files.Keys.GetEnumerator();
                iter.MoveNext();
                filename = iter.Current;
            }

            //Set the name (If we have no filename, fall back to the username)
            var name     = (filename == null) ? (_gist.User == null ? "Unknown" : _gist.User.Login) : filename;
            var imageUri = (_gist.User == null) ? null : new Uri(_gist.User.AvatarUrl);
            var img      = ImageLoader.DefaultRequestImage(imageUri, this);

            if (img != null)
            {
                Image = img;
            }

            if (_full)
            {
                gcell.SetInformation(Image, name, _gist.CreatedAt.ToDaysAgo(), str, _gist.Forks.Count, _gist.Comments, 0);
            }
            else
            {
                gcell.SetInformation(Image, name, _gist.CreatedAt.ToDaysAgo(), str);
            }

            return(gcell);
        }