Esempio n. 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="AListenerBasePort">Base port to listen on.  The actual port used will be the first available one in a range of ports starting here</param>
        /// <param name="AGuiForm">The form that owns this class and handles messages</param>
        /// <param name="AWebSiteList">A list of WebSite objects that are to be reported to the Manager</param>
        public ServerManagerListener(Int32 AListenerBasePort, IOPWebServerManagerActions AGuiForm, WebSites AWebSiteList)
        {
            _listenerBasePort = AListenerBasePort;
            _guiForm = AGuiForm;

            _webSites = AWebSiteList;
        }
Esempio n. 2
0
        /// <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";
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        public SitePropertiesDialog(OpenMode mode, WebSites Sites, string ActiveSiteKey)
        {
            _openMode      = mode;
            _webSites      = Sites;
            _activeSitekey = ActiveSiteKey;

            InitializeComponent();
        }
Esempio n. 4
0
        /// <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());
        }