public async Task <int> LoadRooms() { string retMsg; int nRoomCount = 0; Boolean bRoomListFound = false; rooms = new Dictionary <String, RoomList>(); if (this.roomList == null) { int nRlistcount = await LoadRoomList(); if (nRlistcount >= 1) { //We have Room lists //Iterate through it... bRoomListFound = true; retMsg = await wClient.GET(RoomListsEP); //If the response from Graph is an Error an Exception will be thrown... this.roomList = JsonConvert.DeserializeObject <RoomList>(retMsg); if (this.roomList != null) { foreach (var rlo in this.roomList.Rooms) { retMsg = await wClient.GET($"{RoomsEP}/{rlo.Address}"); RoomList r = JsonConvert.DeserializeObject <RoomList>(retMsg); rooms.Add(rlo.Name, r); nRoomCount += r.Rooms.Count; } } } } if (!bRoomListFound) { try { retMsg = await wClient.GET(RoomsEP); RoomList r = JsonConvert.DeserializeObject <RoomList>(retMsg); rooms.Add("ALL", r); nRoomCount += r.Rooms.Count; } catch (Exception ex) { throw ex; } } return(nRoomCount); }
public async Task <int> LoadRoomList() { string retMsg; int nRoomCount = 0; roomList = new RoomList(); try { retMsg = await wClient.GET(RoomListsEP); //If the response from Graph is an Error an Exception will be thrown... this.roomList = JsonConvert.DeserializeObject <RoomList>(retMsg); } catch (Exception ex) { throw ex; } return(roomList.Rooms.Count); }