public override UITableViewCell GetCell(UITableView aTableView, NSIndexPath aIndexPath) { CellRoom cell = aTableView.DequeueReusableCell(kCellIdentifier) as CellRoom; if (cell == null) { CellRoomFactory factory = new CellRoomFactory(); NSBundle.MainBundle.LoadNib("CellRoom", factory, null); cell = factory.Cell; if (iStandbyButtonOffsetX != 0) { cell.SetStandbyButtonOffsetX(iStandbyButtonOffsetX); } } Linn.Kinsky.Room room = iRooms[aIndexPath.Row]; cell.BackgroundColor = UIColor.Black; cell.SelectionStyle = UITableViewCellSelectionStyle.Gray; cell.TextLabel.TextColor = UIColor.White; cell.Standby = room.Standby; cell.Position = aIndexPath.Row; cell.Title = room.Name; cell.Accessory = (iRoom == room) ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None; return(cell); }
public void InsertItem(int aIndex, Linn.Kinsky.Room aRoom) { iTableView.BeginUpdates(); iRooms.Insert(aIndex, aRoom); iTableView.InsertRows(new NSIndexPath[] { NSIndexPath.FromRowSection(aIndex, 0) }, UITableViewRowAnimation.Fade); iTableView.EndUpdates(); }
public void RemoveItem(Linn.Kinsky.Room aRoom) { int index = iRooms.IndexOf(aRoom); iTableView.BeginUpdates(); iRooms.Remove(aRoom); iTableView.DeleteRows(new NSIndexPath[] { NSIndexPath.FromRowSection(index, 0) }, UITableViewRowAnimation.Fade); iTableView.EndUpdates(); }
public NSIndexPath IndexPathFor(Linn.Kinsky.Room aRoom) { int index = iRooms.IndexOf(aRoom); if (index > -1) { return(NSIndexPath.FromRowSection(index, 0)); } else { return(null); } }
public void SetSelected(T aItem) { if (aItem is Linn.Kinsky.Room) { Linn.Kinsky.Room room = aItem as Linn.Kinsky.Room; iButton.Title = room.Name; } else if (aItem is Linn.Kinsky.Source) { Linn.Kinsky.Source source = aItem as Linn.Kinsky.Source; iButton.Title = String.Format("{0}", source.Name); } else { iButton.Title = iDefaultTitle; Dismiss(); } iSelectedItem = aItem; }
public void SetRoom(Linn.Kinsky.Room aRoom) { if (aRoom != iRoom) { Linn.Kinsky.Room oldRoom = iRoom; iRoom = aRoom; iTableView.BeginUpdates(); int oldIndex = iRooms.IndexOf(oldRoom); if (oldIndex > -1) { NSIndexPath path = NSIndexPath.FromRowSection(oldIndex, 0); UITableViewCell cell = iTableView.CellAt(path); if (cell != null) { cell.AccessoryView = null; } iTableView.ReloadRows(new NSIndexPath[] { path }, UITableViewRowAnimation.Fade); } int newIndex = iRooms.IndexOf(aRoom); if (newIndex > -1) { NSIndexPath path = NSIndexPath.FromRowSection(newIndex, 0); /*UITableViewCell cell = iTableView.CellAt(NSIndexPath.FromRowSection(newIndex, 0)); * if(cell != null) * { * cell.AccessoryView = iButtonStandby; * }*/ iTableView.ReloadRows(new NSIndexPath[] { path }, UITableViewRowAnimation.Fade); } iTableView.EndUpdates(); } }
private void btnStandby_Click(object sender, RoutedEventArgs e) { Linn.Kinsky.Room room = ((e.OriginalSource as FrameworkElement).FindVisualAncestor <ListViewItem>().Content as RoomViewModel).WrappedItem; room.Standby = true; e.Handled = true; }