예제 #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (!isActivated)
     {
         Thread wsThread = new Thread(WebScriptManager.RunExecutionQueue);
         wsThread.IsBackground = true;
         wsThread.Start();
         Thread servThread = new Thread(() =>
         {
             HttpExchange.Run();
         });
         servThread.IsBackground = true;
         servThread.Start();
         serverThread = servThread;
         try
         {
             IDEServer = new SimpleWebServer.WebServer(Utils.HandleIDE, "http://localhost:" + ConfigurationManager.SETTINGS["IDE_PORT"] + "/");
             IDEServer.Run();
         }
         catch { MessageBox.Show("Failed to initialize IDE server!"); }
         isActivated  = true;
         button2.Text = "Stop server";
     }
     else
     {
         try
         {
             IDEServer.Stop();
         }
         catch { MessageBox.Show("Failed to stop IDE server!"); }
         WebScriptManager.StopExecutionQueue();
         try
         {
             HttpExchange._server.Close();
             serverThread.Abort();
             serverThread.Interrupt();
         }
         catch { MessageBox.Show("LWASP was unable to stop the server!\r\nPlease try again or restart LWASP"); }
         isActivated  = false;
         button2.Text = "Start server";
     }
 }
예제 #2
0
 public void Destroy()
 {
     callbackServer.Stop();
 }