public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var distinct = Items.Select(x => x.HeaderTitle).Distinct().ToList();
            string headerTitle = distinct[indexPath.Section];
            var items = Items.Where(x => x.HeaderTitle == headerTitle).ToList();
            var item = items[indexPath.Row];

            SessionsPreferenceTableViewCell cell = (SessionsPreferenceTableViewCell)tableView.DequeueReusableCell(CellIdentifier);
            if (cell == null)
            {
                var cellStyle = UITableViewCellStyle.Subtitle;
                cell = new SessionsPreferenceTableViewCell(cellStyle, CellIdentifier);
                cell.OnPreferenceValueChanged += PreferenceValueChanged;
            }

            if (!string.IsNullOrEmpty(item.IconName))
            {
                cell.ImageView.Alpha = 0.7f;
                cell.ImageView.Image = UIImage.FromBundle(string.Format("/Images/Icons/{0}", item.IconName));
            }

            cell.Tag = indexPath.Row;
            cell.Accessory = UITableViewCellAccessory.None;
            cell.SetItem(item);

            return cell;
        }           
Пример #2
0
        public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var distinct = _items.Select(x => x.HeaderTitle).Distinct().ToList();
            string headerTitle = distinct[indexPath.Section];
            var items = _items.Where(x => x.HeaderTitle == headerTitle).ToList();
            var item = items[indexPath.Row];

            SessionsPreferenceTableViewCell cell = (SessionsPreferenceTableViewCell)tableView.DequeueReusableCell(_cellIdentifier);
            if (cell == null)
            {
                var cellStyle = UITableViewCellStyle.Subtitle;
                cell = new SessionsPreferenceTableViewCell(cellStyle, _cellIdentifier);
            }

            cell.ImageView.Alpha = 0.7f;
            switch (item.MenuType)
            {
                case MobileOptionsMenuType.About:
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_info");
                    break;
                case MobileOptionsMenuType.EqualizerPresets:
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_eq");
                    break;
                case MobileOptionsMenuType.Preferences:
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_settings");
                    break;
                case MobileOptionsMenuType.SyncLibrary:
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/wifi");
                    break;
                case MobileOptionsMenuType.SyncLibraryWebBrowser:
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_web");
                    break;
                case MobileOptionsMenuType.SyncLibraryCloud:
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_cloud");
                    break;
                case MobileOptionsMenuType.SyncLibraryFileSharing:
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_share");
                    break;
                case MobileOptionsMenuType.ResumePlayback:
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_resume");
                    break;
                case MobileOptionsMenuType.AudioPreferences:
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_audio");
                    break;   
                case MobileOptionsMenuType.CloudPreferences:
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_cloud");
                    break;   
                case MobileOptionsMenuType.GeneralPreferences:
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_settings");
                    break;   
                case MobileOptionsMenuType.LibraryPreferences:
                    cell.ImageView.Image = UIImage.FromBundle("Images/Icons/icon_library");
                    break;   
            }
            
            cell.TextLabel.Text = item.Title;
            cell.Accessory = UITableViewCellAccessory.None;
            cell.IsLargeIcon = true;
            cell.ImageChevron.Image = UIImage.FromBundle("Images/Tables/chevron");
            cell.ImageChevron.Hidden = false;

            return cell;
        }