async Task ExecuteRefreshCommand() { if (IsBusy) { return; } IsBusy = true; try { await CloudService.SyncOfflineCacheAsync(); var table = await CloudService.GetTableAsync <Room>(); var list = await table.ReadAllRoomsAsync(); AllRooms.Clear(); DisplayedRooms.Clear(); foreach (var room in list) { AllRooms.Add(room); DisplayedRooms.Add(room); SortRooms(DisplayedRooms, room); } } catch (Exception ex) { Debug.WriteLine($"[RoomListViewModel] Error loading items: {ex.Message}"); } finally { IsBusy = false; } }
void Search(String searchArgument) { if (searchArgument.Equals("")) { foreach (Room room in AllRooms) { DisplayedRooms.Add(room); } } else { DisplayedRooms.Clear(); foreach (Room room in AllRooms) { if (room.Name.Contains(searchArgument) || room.Floor.Contains(searchArgument)) { DisplayedRooms.Add(room); } } } }