示例#1
0
        private void btnStartServer_Click(object sender, EventArgs e)
        {
            _logWriter.Write(this, LogPrio.Info, "Starting " + SelectedFrameworkName + " on port 9876...");
            string appName = radRackApp.Checked ? "RackApp" : radSinatraApp.Checked ?  "Sinatra" : "Rails";

               if(radBracket.Checked)
               {
               _bracketServer = new DefaultRackServer(9876, IPAddress.Any, _logWriter);
               _bracketServer.Start(new RubyEnvironment(env => env.ApplicationRootPath = appName));
               }
               else if (radFramework.Checked)
               {
               _frameworkServer = new HttpListenerRackServer(9876);
               _frameworkServer.Start(new RubyEnvironment(env => env.ApplicationRootPath = appName));
               }

            _logWriter.Write(this, LogPrio.Info, SelectedFrameworkName + " Started!");

            btnBrowserNavigate.PerformClick();

            grpServerLib.Enabled = false;
            grpApplicationType.Enabled = false;
            btnStartServer.Enabled = false;
            btnStopServer.Enabled = true;
        }
示例#2
0
        private void btnStopServer_Click(object sender, EventArgs e)
        {
            txtOutput.Clear();
            webBrowser.Navigate("");

            _logWriter.Write(this,LogPrio.Info,"Stopping " + SelectedFrameworkName + "...");

            if (radBracket.Checked)
            {
                if (_bracketServer != null)
                    _bracketServer.Dispose();
                _bracketServer = null;
            }
            else if (radFramework.Checked)
            {
                if (_frameworkServer != null)
                    _frameworkServer.Dispose();
                _frameworkServer = null;
            }

            _logWriter.Write(this, LogPrio.Info,SelectedFrameworkName + " Stopped.");

            grpServerLib.Enabled = true;
            grpApplicationType.Enabled = true;
            btnStartServer.Enabled = true;
            btnStopServer.Enabled = false;
        }