/// <summary> /// Constructor sets up, but does not start, the web server /// for interacting with a tablet device. /// </summary> /// <remarks> /// If a port is not provided, the DefaultPort is used /// instead. /// </remarks> public TabletHost(IWebRequestHandler handler, string localIP, int port = -1) { Handler = handler; Listener = new WebHost(localIP, port == -1 ? DefaultPort : port); Listener.OnRequest += (sender, e) => { Handler.HandleRequest(e); }; }
/// <summary> /// Send the response. /// </summary> public virtual void RunTask() { try { Handler.HandleRequest(Context); } catch (Exception ex) { Session.UserSession.Current.Console.Add("WEB ERROR: " + ex.Message, "KernelWebHost.RequestTask"); } finally { Context.Finish(); } }