コード例 #1
0
 public void MoveLayer(Layer selectedLayer)
 {
     // Remove the layer from the list it is currently in and add it to the other list.
     if (IncludedLayers.Contains(selectedLayer))
     {
         IncludedLayers.Remove(selectedLayer);
         ExcludedLayers.Add(selectedLayer);
     }
     else
     {
         ExcludedLayers.Remove(selectedLayer);
         IncludedLayers.Add(selectedLayer);
     }
 }
        public void MoveLayer(LayerCollection owningCollection, int position)
        {
            // Find the selected layer.
            Layer selectedLayer = owningCollection[position];

            // Move the layer from one list to another by removing it from the source list and adding it to the destination list.
            if (IncludedLayers.Contains(selectedLayer))
            {
                IncludedLayers.Remove(selectedLayer);
                ExcludedLayers.Add(selectedLayer);
            }
            else
            {
                ExcludedLayers.Remove(selectedLayer);
                IncludedLayers.Add(selectedLayer);
            }
        }
        public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
        {
            // Commit editing - in this case, editing means insertion or deletion.

            Layer selectedLayer;

            switch (indexPath.Section)
            {
            case 0:
                selectedLayer = IncludedLayers[indexPath.Row];
                IncludedLayers.Remove(selectedLayer);
                ExcludedLayers.Add(selectedLayer);
                break;

            case 1:
                selectedLayer = ExcludedLayers[indexPath.Row];
                ExcludedLayers.Remove(selectedLayer);
                IncludedLayers.Add(selectedLayer);
                break;
            }

            // Force the view to reload its data.
            tableView.ReloadData();
        }