protected override Task Poll()
        {
            if (!API.IsLoggedIn)
            {
                return(base.Poll());
            }

            var tcs = new TaskCompletionSource <bool>();

            pollReq?.Cancel();
            pollReq = new GetRoomsRequest(currentFilter.Value.Status, currentFilter.Value.Category);

            pollReq.Success += result =>
            {
                for (int i = 0; i < result.Count; i++)
                {
                    if (result[i].RoomID.Value == selectedRoom.Value?.RoomID.Value)
                    {
                        // The listing request always has less information than the opened room, so don't include it.
                        result[i] = selectedRoom.Value;
                        break;
                    }
                }

                NotifyRoomsReceived(result);
                tcs.SetResult(true);
            };

            pollReq.Failure += _ => tcs.SetResult(false);

            API.Queue(pollReq);

            return(tcs.Task);
        }
Exemplo n.º 2
0
    public async Task <IList <Room> > HandleAsync(GetRoomsRequest request, CancellationToken cancellationToken)
    {
        var rooms = await _dbContext.Rooms
                    .Include(room => room.Users)
                    .Include(room => room.Episode.Show).ToListAsync(cancellationToken);

        return(rooms);
    }
Exemplo n.º 3
0
        // Token: 0x06001ABF RID: 6847 RVA: 0x00064FA0 File Offset: 0x000631A0
        private ServiceResult <EwsRoomType[]> GetSpecifiedRooms()
        {
            GetRoomsRequest getRoomsRequest = new GetRoomsRequest();

            getRoomsRequest.RoomList = new EmailAddressWrapper
            {
                EmailAddress = this.roomList
            };
            GetRooms getRooms = new GetRooms(base.CallContext, getRoomsRequest);

            getRooms.PreExecute();
            ServiceResult <EwsRoomType[]> serviceResult = getRooms.Execute();

            getRooms.SetCurrentStepResult(serviceResult);
            getRooms.PostExecute();
            return(serviceResult);
        }
Exemplo n.º 4
0
        protected override Task Poll()
        {
            if (!API.IsLoggedIn)
            {
                return(base.Poll());
            }

            if (Filter.Value == null)
            {
                return(base.Poll());
            }

            var tcs = new TaskCompletionSource <bool>();

            lastPollRequest?.Cancel();

            var req = new GetRoomsRequest(Filter.Value.Status, Filter.Value.Category);

            req.Success += result =>
            {
                foreach (var existing in RoomManager.Rooms.ToArray())
                {
                    if (result.All(r => r.RoomID.Value != existing.RoomID.Value))
                    {
                        RoomManager.RemoveRoom(existing);
                    }
                }

                foreach (var incoming in result)
                {
                    incoming.RemoveExpiredPlaylistItems();
                    RoomManager.AddOrUpdateRoom(incoming);
                }

                initialRoomsReceived.Value = true;
                tcs.SetResult(true);
            };

            req.Failure += _ => tcs.SetResult(false);

            API.Queue(req);

            lastPollRequest = req;
            return(tcs.Task);
        }
Exemplo n.º 5
0
        protected override Task Poll()
        {
            if (!api.IsLoggedIn)
            {
                return(base.Poll());
            }

            var tcs = new TaskCompletionSource <bool>();

            pollReq?.Cancel();
            pollReq = new GetRoomsRequest(currentFilter.PrimaryFilter);

            pollReq.Success += result =>
            {
                // Remove past matches
                foreach (var r in rooms.ToList())
                {
                    if (result.All(e => e.RoomID.Value != r.RoomID.Value))
                    {
                        rooms.Remove(r);
                    }
                }

                for (int i = 0; i < result.Count; i++)
                {
                    var r = result[i];
                    r.Position = i;

                    update(r, r);
                    addRoom(r);
                }

                RoomsUpdated?.Invoke();

                tcs.SetResult(true);
            };

            pollReq.Failure += _ => tcs.SetResult(false);

            api.Queue(pollReq);

            return(tcs.Task);
        }