public void NavigateTo(object item) { var index = -1; if (item != null && item.IsNot <SeatBox>()) { var seatId = item.ToString(); if (_seatBoxes.ContainsKey(seatId)) { var target = (SeatBox)_seatBoxes[seatId]; if (target.Seat.Area != SelectedArea) { FilterSeats(target.Seat.Area); SelectedArea = target.Seat.Area; } index = BindableSeats.IndexOf(target); } } if (index == -1) { return; } CurrentIndex = index; SelectedSeat = BindableSeats[index] as SeatBox; }
private Action RetainCurrentSelectedSeat() { var selectedIndex = BindableSeats.IndexOf(SelectedSeat); return(() => { SelectedSeat = selectedIndex == -1 ? null : _bindableSeats[selectedIndex] as SeatBox; }); }