Exemple #1
0
        public async Task <Message> WaitForAnswerAsync()
        {
            Task delay = Task.Delay(Delay);
            Task res   = await Task.WhenAny(communication.ReceiveAsync(), delay);

            if (res is Task <Message> )
            {
                return(((Task <Message>)res).Result);
            }

            if (res == delay)
            {
                throw new Exception("Did not receive an answer in time...");
            }
            throw new Exception("Cant start debugging");
        }
        public async Task <MessageBase> WaitForAnswerAsync(int _delay = 10000)
        {
            Task delay = Task.Delay(_delay);
            Task msg   = await Task.WhenAny(communication.ReceiveAsync(), delay);

            if (msg is Task <MessageBase> )
            {
                return((msg as Task <MessageBase>).Result);
            }

            if (msg == delay)
            {
                throw new Exception("Did not receive an answer in time...");
            }
            throw new Exception("Cant start debugging");
        }