Exemple #1
0
 public override bool Handle(HttpListenerRequest request, out string response)
 {
     response = "";
     if (request.RawUrl.StartsWith("/api/getIPAddresses"))
     {
         response = JsonConvert.SerializeObject(HttpServerKit.GetIPAddress());
         return(true);
     }
     return(false);
 }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            notifyIconKit = container.Resolve <NotifyIconKit>();
            httpServerKit = container.Resolve <HttpServerKit>();

            log.Debug("[Application_Startup] Showing NotifyIcon");
            notifyIconKit.Show();

            var uiLauncher = container.Resolve <UILauncher>();

            httpServerKit.RegisterUILauncher(uiLauncher);
            notifyIconKit.RegisterUILauncher(uiLauncher);
            httpServerKit.RegisterPortChangedObserver(notifyIconKit);
            httpServerKit.RegisterPortChangedObserver(uiLauncher);

            // Start server
            log.Debug("[Application_Startup] Launching HTTP Server");
            httpServerKit.Start();

            log.Debug("[Application_Startup] Launching Web UI");
            uiLauncher.LaunchWebUI();
        }