Ejemplo n.º 1
0
        public async Task <IHttpActionResult> Put()
        {
            try
            {
                Trace.TraceInformation($"PUT request. Starting resuming conversations");

                await ConversationStarter.Resume();

                return(Ok());
            }
            catch (Exception ex)
            {
                Trace.TraceError("PUT: Exception when resuming", ex);

                return(BadRequest(ex.ToString()));
            }
        }
        public async Task <HttpResponseMessage> SendMessage()
        {
            try
            {
                if (!string.IsNullOrEmpty(ConversationStarter.fromId))
                {
                    await ConversationStarter.Resume(ConversationStarter.conversationId, ConversationStarter.channelId); //We don't need to wait for this, just want to start the interruption here

                    var resp = new HttpResponseMessage(HttpStatusCode.OK);
                    resp.Content = new StringContent($"<html><body>Message sent, thanks.</body></html>", System.Text.Encoding.UTF8, @"text/html");
                    return(resp);
                }
                else
                {
                    var resp = new HttpResponseMessage(HttpStatusCode.OK);
                    resp.Content = new StringContent($"<html><body>You need to talk to the bot first so it can capture your details.</body></html>", System.Text.Encoding.UTF8, @"text/html");
                    return(resp);
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
Ejemplo n.º 3
0
 public void timerEvent(object target)
 {
     t.Dispose();
     ConversationStarter.Resume(ConversationStarter.conversationId, ConversationStarter.channelId); //We don't need to wait for this, just want to start the interruption here
 }