Exemple #1
0
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                UITableViewCell       cell           = tableView.DequeueReusableCell(kCellIdentifier);
                var                   s              = _slots[indexPath.Row];
                SessionCellController cellController = null;

                if (cell == null)
                {
                    cellController = new SessionCellController();
                    NSBundle.MainBundle.LoadNib("SessionCellController", cellController, null);
                    cell     = cellController.Cell;
                    cell.Tag = Environment.TickCount;
                    //HACK: fix this crappy hack
                    controllers.Add(cell.Tag, cellController);
                }
                else
                {
                    cellController = controllers[cell.Tag];
                }
                if (s.Title == "Workshops" || s.Title == "Sessions")
                {
                    cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton;
                }
                else if (!String.IsNullOrEmpty(s.Brief))
                {
                    cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                }
                else
                {
                    cell.Accessory = UITableViewCellAccessory.None;
                }
                try {
                    Debug.WriteLine("Original time: " + s.StartTime.ToString());
                    Debug.WriteLine("Universal time: " + s.StartTime.ToUniversalTime().ToString());
                    Debug.WriteLine("Local time: " + s.StartTime.ToLocalTime().ToString());
                    cellController.SessionTitle = s.Title;
                    cellController.Subtitle     = "";
                    // TODO: chosen one?
                    cellController.Time = s.StartTime.ToUniversalTime().ToString("HH:mm");
                    if (s.StartTime.ToUniversalTime() == s.EndTime.ToUniversalTime())
                    {
                        cellController.EndTime = "";
                    }
                    else
                    {
                        cellController.EndTime = s.EndTime.ToUniversalTime().ToString("HH:mm");
                    }
                } catch (Exception) {
                }
                return(cell);
            }
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                UITableViewCell cell = tableView.DequeueReusableCell (kCellIdentifier);
                var s = _slots[indexPath.Row];
                SessionCellController cellController = null;

                if (cell == null) {
                    cellController = new SessionCellController ();
                    NSBundle.MainBundle.LoadNib ("SessionCellController", cellController, null);
                    cell = cellController.Cell;
                    cell.Tag = Environment.TickCount;
                    //HACK: fix this crappy hack
                    controllers.Add (cell.Tag, cellController);
                } else {
                    cellController = controllers[cell.Tag];
                }
                if (s.Title == "Workshops" || s.Title == "Sessions")
                    cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton; else if (!String.IsNullOrEmpty (s.Brief))
                    cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                else
                    cell.Accessory = UITableViewCellAccessory.None;
                try {
                    Debug.WriteLine ("Original time: " + s.StartTime.ToString ());
                    Debug.WriteLine ("Universal time: " + s.StartTime.ToUniversalTime ().ToString ());
                    Debug.WriteLine ("Local time: " + s.StartTime.ToLocalTime ().ToString ());
                    cellController.SessionTitle = s.Title;
                    cellController.Subtitle = "";
                    // TODO: chosen one?
                    cellController.Time = s.StartTime.ToUniversalTime ().ToString ("HH:mm");
                    if (s.StartTime.ToUniversalTime () == s.EndTime.ToUniversalTime ())
                        cellController.EndTime = "";
                    else
                        cellController.EndTime = s.EndTime.ToUniversalTime ().ToString ("HH:mm");
                } catch (Exception) {
                }
                return cell;
            }