/// <summary> /// Constructor /// </summary> public MainForm() { InitializeComponent(); //read in the site info from the settings xml file _webSites = new WebSites(); _webSites.Read(out _startAutomatically, out _hideAtStartup, out _allowRemoteConnections); // Create a listener for ServerManager messages _managerListener = new ServerManagerListener(Program.SERVER_MANAGER_BASE_PORT, this, _webSites); _managerListener.StartListening(); // Create the help site and start the server unless another instance of the app has already done it _helpSite = Program.CreateHelpWebSite(); if (!Program.PortIsInUse(_helpSite.Port, false) && (_helpSite.PhysicalPath != String.Empty)) { _helpSite.WebServer = new Server(_helpSite.Port, _helpSite.VirtualPath, _helpSite.PhysicalPath, _helpSite.DefaultPage, false, false); } //Populate the list box and update the link label UpdateUI(); //If we are set to start the servers automatically, do it now if (_startAutomatically) { toolStripStatusLabel.Text = StartOrStopAll(true); } else { //otherwise just update the tray icon text notifyIcon.Text = Program.ApplicationTitleAndVersion; notifyIcon.Text += "\r\nStopped"; } }
/// <summary> /// This is the constructor that is used when command line parameters are used /// </summary> /// <param name="PhysicalPath"></param> /// <param name="VirtualPath"></param> /// <param name="Port"></param> /// <param name="DefaultPage"></param> /// <param name="AllowRemoteConnection"></param> /// <param name="LogPageRequests"></param> public SmallUIForm(string PhysicalPath, string VirtualPath, int Port, string DefaultPage, bool AllowRemoteConnection, bool LogPageRequests) { InitializeComponent(); _webSite.PhysicalPath = PhysicalPath; _webSite.VirtualPath = VirtualPath; _webSite.Port = Port; _webSite.DefaultPage = DefaultPage; _webSite.LogPageRequests = LogPageRequests; _allowRemoteConnection = AllowRemoteConnection; txtPhysicalPath.Text = _webSite.PhysicalPath; txtVirtualPath.Text = _webSite.VirtualPath.Substring(1); txtPortNumber.Text = _webSite.Port.ToString(); txtDefaultPage.Text = _webSite.DefaultPage; linkLabel.Text = _webSite.Url; chkAllowRemoteConnection.Checked = _allowRemoteConnection; chkLogPageRequests.Checked = _webSite.LogPageRequests; // Create a listener for ServerManager messages _webSites = new WebSites(); _webSites.Add("FormSite", _webSite); _managerListener = new ServerManagerListener(Program.SERVER_MANAGER_BASE_PORT, this, _webSites); _managerListener.StartListening(); // Create the help site and start the server unless another instance of the app has already done it _helpSite = Program.CreateHelpWebSite(); if (!Program.PortIsInUse(_helpSite.Port, false) && (_helpSite.PhysicalPath != String.Empty)) { _helpSite.WebServer = new Server(_helpSite.Port, _helpSite.VirtualPath, _helpSite.PhysicalPath, _helpSite.DefaultPage, false, false); } // Set the main window title this.Text = String.Format("{0} [{1}]", Program.ApplicationTitle, _webSite.Port.ToString()); }