Example #1
0
            public override bool ShouldSelectItem(UICollectionView collectionView, NSIndexPath indexPath)
            {
                var selectionCount = collectionView.GetIndexPathsForSelectedItems().Length;
                var shouldSelect   = true;
                var asset          = AssetForIndexPath(indexPath);

                var parent = Parent;

                if (parent != null)
                {
                    shouldSelect = parent.ShouldSelectAsset(asset, selectionCount);
                }

                return(shouldSelect);
            }
Example #2
0
    /// <summary>
    /// Gets the cell.
    /// </summary>
    /// <param name="tableView">The table view.</param>
    /// <param name="indexPath">The index path.</param>
    /// <returns></returns>
    public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
    {
        // reuse or create new cell
        var cell = (UICollectionViewCell)collectionView.DequeueReusableCell(cellProvider.Identifier, indexPath);

        // get the associated collection item
        var item = GetItemAt(indexPath);

        // update the cell
        if (item != null)
        {
            cellProvider.UpdateCell(cell, item, collectionView.GetIndexPathsForSelectedItems().Contains(indexPath));
        }

        // done
        return(cell);
    }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            var headerCell = (ShellSectionHeaderCell)collectionView.DequeueReusableCell(CellId, indexPath);

            var selectedItems = collectionView.GetIndexPathsForSelectedItems();

            var shellContent = ShellSection.Items[indexPath.Row];

            headerCell.Label.Text = shellContent.Title;
            headerCell.Label.SetNeedsDisplay();

            if (selectedItems.Length > 0 && selectedItems[0].Row == indexPath.Row)
            {
                headerCell.Label.TextColor = _selectedColor.ToUIColor();
            }
            else
            {
                headerCell.Label.TextColor = _unselectedColor.ToUIColor();
            }

            return(headerCell);
        }
        List <BluetoothSensorMonitor> GetMonitorsForSelectedPeripherals()
        {
            List <BluetoothSensorMonitor> bluetoothMonitors = new List <BluetoothSensorMonitor>();

            var selectedItems = _connectedDevicesCollectionView.GetIndexPathsForSelectedItems();

            foreach (var selectedItem in selectedItems)
            {
                BluetoothSensorMonitor sensorMonitor = _sensorCollectionSource.GetConnectedMonitor(selectedItem.Row);

                bluetoothMonitors.Add(sensorMonitor);

                //if (sensorMonitor.bIsHexoskinMonitor)
                //{

                //}
                //else
                //{
                //	peripherals.Add(sensorMonitor.Peripheral);
                //}
            }

            return(bluetoothMonitors);
        }
 protected void ClearSelection(UICollectionView collectionView)
 {
     var indexPaths = collectionView.GetIndexPathsForSelectedItems();
     if (indexPaths != null)
     {
         foreach (NSIndexPath indexPath in indexPaths)
             collectionView.DeselectItem(indexPath, UseAnimations);
     }
     SetSelectedItem(collectionView, null, false);
 }