From: <sam...@us...> - 2007-03-11 10:11:35
|
Revision: 35 http://svn.sourceforge.net/mp-webinterface/?rev=35&view=rev Author: samuel337 Date: 2007-03-11 03:11:22 -0700 (Sun, 11 Mar 2007) Log Message: ----------- tidied up code, added in version info and log buttons, added error handling/data validation routines Modified Paths: -------------- trunk/Version2/Control Center/Control_Center_App.Designer.cs trunk/Version2/Control Center/Control_Center_App.cs Modified: trunk/Version2/Control Center/Control_Center_App.Designer.cs =================================================================== --- trunk/Version2/Control Center/Control_Center_App.Designer.cs 2007-03-09 22:37:29 UTC (rev 34) +++ trunk/Version2/Control Center/Control_Center_App.Designer.cs 2007-03-11 10:11:22 UTC (rev 35) @@ -28,363 +28,505 @@ /// </summary> private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Control_Center_App)); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.statusMPWServerConn = new System.Windows.Forms.Label(); - this.statusTVService = new System.Windows.Forms.Label(); - this.statusTVServerConn = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.linkLabel1 = new System.Windows.Forms.LinkLabel(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.saveButton = new System.Windows.Forms.Button(); - this.bindIPBox = new System.Windows.Forms.TextBox(); - this.accessModeDropDown = new System.Windows.Forms.ComboBox(); - this.label9 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.linkLabel2 = new System.Windows.Forms.LinkLabel(); - this.label7 = new System.Windows.Forms.Label(); - this.portBox = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.startstopButton = new System.Windows.Forms.Button(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.button1 = new System.Windows.Forms.Button(); - this.trayIcon = new System.Windows.Forms.NotifyIcon(this.components); - this.trayContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this.trayStart = new System.Windows.Forms.ToolStripMenuItem(); - this.stopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.refreshTimer = new System.Windows.Forms.Timer(this.components); - this.groupBox1.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.groupBox3.SuspendLayout(); - this.trayContextMenu.SuspendLayout(); - this.SuspendLayout(); - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.statusMPWServerConn); - this.groupBox1.Controls.Add(this.statusTVService); - this.groupBox1.Controls.Add(this.statusTVServerConn); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Location = new System.Drawing.Point(12, 12); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(300, 139); - this.groupBox1.TabIndex = 0; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Status information"; - // - // statusMPWServerConn - // - this.statusMPWServerConn.AutoSize = true; - this.statusMPWServerConn.Location = new System.Drawing.Point(139, 102); - this.statusMPWServerConn.Name = "statusMPWServerConn"; - this.statusMPWServerConn.Size = new System.Drawing.Size(86, 13); - this.statusMPWServerConn.TabIndex = 7; - this.statusMPWServerConn.Text = "Not checked yet"; - // - // statusTVService - // - this.statusTVService.AutoSize = true; - this.statusTVService.Location = new System.Drawing.Point(139, 35); - this.statusTVService.Name = "statusTVService"; - this.statusTVService.Size = new System.Drawing.Size(86, 13); - this.statusTVService.TabIndex = 6; - this.statusTVService.Text = "Not checked yet"; - // - // statusTVServerConn - // - this.statusTVServerConn.AutoSize = true; - this.statusTVServerConn.Location = new System.Drawing.Point(139, 67); - this.statusTVServerConn.Name = "statusTVServerConn"; - this.statusTVServerConn.Size = new System.Drawing.Size(86, 13); - this.statusTVServerConn.TabIndex = 5; - this.statusTVServerConn.Text = "Not checked yet"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(6, 102); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(92, 13); - this.label3.TabIndex = 2; - this.label3.Text = "MPW Webserver:"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 67); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(127, 13); - this.label2.TabIndex = 1; - this.label2.Text = "Connection to TV Server:"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 35); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(63, 13); - this.label1.TabIndex = 0; - this.label1.Text = "TV Service:"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(6, 118); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(92, 13); - this.label6.TabIndex = 4; - this.label6.Text = "MPW Homepage:"; - // - // linkLabel1 - // - this.linkLabel1.AutoSize = true; - this.linkLabel1.Location = new System.Drawing.Point(104, 118); - this.linkLabel1.Name = "linkLabel1"; - this.linkLabel1.Size = new System.Drawing.Size(166, 13); - this.linkLabel1.TabIndex = 3; - this.linkLabel1.TabStop = true; - this.linkLabel1.Text = "http://www.mp-webinterface.com"; - this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); - // - // groupBox2 - // - this.groupBox2.Controls.Add(this.saveButton); - this.groupBox2.Controls.Add(this.bindIPBox); - this.groupBox2.Controls.Add(this.accessModeDropDown); - this.groupBox2.Controls.Add(this.label9); - this.groupBox2.Controls.Add(this.label8); - this.groupBox2.Controls.Add(this.linkLabel2); - this.groupBox2.Controls.Add(this.label7); - this.groupBox2.Controls.Add(this.portBox); - this.groupBox2.Controls.Add(this.label4); - this.groupBox2.Location = new System.Drawing.Point(318, 12); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(300, 283); - this.groupBox2.TabIndex = 1; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "MPW Webserver setup"; - // - // saveButton - // - this.saveButton.Location = new System.Drawing.Point(126, 132); - this.saveButton.Name = "saveButton"; - this.saveButton.Size = new System.Drawing.Size(115, 23); - this.saveButton.TabIndex = 10; - this.saveButton.Text = "Save Configuration"; - this.saveButton.UseVisualStyleBackColor = true; - this.saveButton.Click += new System.EventHandler(this.saveButton_Click); - // - // bindIPBox - // - this.bindIPBox.Location = new System.Drawing.Point(126, 59); - this.bindIPBox.Name = "bindIPBox"; - this.bindIPBox.Size = new System.Drawing.Size(115, 20); - this.bindIPBox.TabIndex = 9; - // - // accessModeDropDown - // - this.accessModeDropDown.FormattingEnabled = true; - this.accessModeDropDown.Items.AddRange(new object[] { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Control_Center_App)); + this.gBxStatus = new System.Windows.Forms.GroupBox(); + this.statusMPWServerConn = new System.Windows.Forms.Label(); + this.statusTVService = new System.Windows.Forms.Label(); + this.statusTVServerConn = new System.Windows.Forms.Label(); + this.LblMPWWebServerStatusDesc = new System.Windows.Forms.Label(); + this.LblTVServerConnStatusDesc = new System.Windows.Forms.Label(); + this.LblTVServiceStatusDesc = new System.Windows.Forms.Label(); + this.LblMPWWebsiteLink = new System.Windows.Forms.Label(); + this.LLblMPWWebsiteLink = new System.Windows.Forms.LinkLabel(); + this.gBxMPWWebServerSetup = new System.Windows.Forms.GroupBox(); + this.saveButton = new System.Windows.Forms.Button(); + this.bindIPBox = new System.Windows.Forms.TextBox(); + this.accessModeDropDown = new System.Windows.Forms.ComboBox(); + this.LblSetupAccessMode = new System.Windows.Forms.Label(); + this.LblSetupBindLocalIP = new System.Windows.Forms.Label(); + this.portBox = new System.Windows.Forms.TextBox(); + this.LblSetupWebserverPort = new System.Windows.Forms.Label(); + this.LLblMPWServerURL = new System.Windows.Forms.LinkLabel(); + this.LblServerURL = new System.Windows.Forms.Label(); + this.startstopButton = new System.Windows.Forms.Button(); + this.gBxMPWWebServer = new System.Windows.Forms.GroupBox(); + this.CmdRefreshStatusInfo = new System.Windows.Forms.Button(); + this.trayIcon = new System.Windows.Forms.NotifyIcon(this.components); + this.trayContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.trayStart = new System.Windows.Forms.ToolStripMenuItem(); + this.stopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.refreshTimer = new System.Windows.Forms.Timer(this.components); + this.gBxAboutMPW = new System.Windows.Forms.GroupBox(); + this.gBxVersion = new System.Windows.Forms.GroupBox(); + this.LblMPWServiceVersion = new System.Windows.Forms.Label(); + this.LblMPWServiceVersionDesc = new System.Windows.Forms.Label(); + this.LblMPWWebserverVersion = new System.Windows.Forms.Label(); + this.LblMPWWebserverVersionDesc = new System.Windows.Forms.Label(); + this.LblMPWCCVersion = new System.Windows.Forms.Label(); + this.LblMPWCCVersionDesc = new System.Windows.Forms.Label(); + this.gBxLogs = new System.Windows.Forms.GroupBox(); + this.CmdOpenAccessLog = new System.Windows.Forms.Button(); + this.CmdOpenEventViewer = new System.Windows.Forms.Button(); + this.gBxStatus.SuspendLayout(); + this.gBxMPWWebServerSetup.SuspendLayout(); + this.gBxMPWWebServer.SuspendLayout(); + this.trayContextMenu.SuspendLayout(); + this.gBxAboutMPW.SuspendLayout(); + this.gBxVersion.SuspendLayout(); + this.gBxLogs.SuspendLayout(); + this.SuspendLayout(); + // + // gBxStatus + // + this.gBxStatus.Controls.Add(this.statusMPWServerConn); + this.gBxStatus.Controls.Add(this.statusTVService); + this.gBxStatus.Controls.Add(this.statusTVServerConn); + this.gBxStatus.Controls.Add(this.LblMPWWebServerStatusDesc); + this.gBxStatus.Controls.Add(this.LblTVServerConnStatusDesc); + this.gBxStatus.Controls.Add(this.LblTVServiceStatusDesc); + this.gBxStatus.Location = new System.Drawing.Point(12, 12); + this.gBxStatus.Name = "gBxStatus"; + this.gBxStatus.Size = new System.Drawing.Size(300, 80); + this.gBxStatus.TabIndex = 0; + this.gBxStatus.TabStop = false; + this.gBxStatus.Text = "Status information"; + // + // statusMPWServerConn + // + this.statusMPWServerConn.AutoSize = true; + this.statusMPWServerConn.Location = new System.Drawing.Point(139, 55); + this.statusMPWServerConn.Name = "statusMPWServerConn"; + this.statusMPWServerConn.Size = new System.Drawing.Size(86, 13); + this.statusMPWServerConn.TabIndex = 7; + this.statusMPWServerConn.Text = "Not checked yet"; + // + // statusTVService + // + this.statusTVService.AutoSize = true; + this.statusTVService.Location = new System.Drawing.Point(139, 16); + this.statusTVService.Name = "statusTVService"; + this.statusTVService.Size = new System.Drawing.Size(86, 13); + this.statusTVService.TabIndex = 6; + this.statusTVService.Text = "Not checked yet"; + // + // statusTVServerConn + // + this.statusTVServerConn.AutoSize = true; + this.statusTVServerConn.Location = new System.Drawing.Point(139, 35); + this.statusTVServerConn.Name = "statusTVServerConn"; + this.statusTVServerConn.Size = new System.Drawing.Size(86, 13); + this.statusTVServerConn.TabIndex = 5; + this.statusTVServerConn.Text = "Not checked yet"; + // + // LblMPWWebServerStatusDesc + // + this.LblMPWWebServerStatusDesc.AutoSize = true; + this.LblMPWWebServerStatusDesc.Location = new System.Drawing.Point(6, 55); + this.LblMPWWebServerStatusDesc.Name = "LblMPWWebServerStatusDesc"; + this.LblMPWWebServerStatusDesc.Size = new System.Drawing.Size(92, 13); + this.LblMPWWebServerStatusDesc.TabIndex = 2; + this.LblMPWWebServerStatusDesc.Text = "MPW Webserver:"; + // + // LblTVServerConnStatusDesc + // + this.LblTVServerConnStatusDesc.AutoSize = true; + this.LblTVServerConnStatusDesc.Location = new System.Drawing.Point(6, 35); + this.LblTVServerConnStatusDesc.Name = "LblTVServerConnStatusDesc"; + this.LblTVServerConnStatusDesc.Size = new System.Drawing.Size(127, 13); + this.LblTVServerConnStatusDesc.TabIndex = 1; + this.LblTVServerConnStatusDesc.Text = "Connection to TV Server:"; + // + // LblTVServiceStatusDesc + // + this.LblTVServiceStatusDesc.AutoSize = true; + this.LblTVServiceStatusDesc.Location = new System.Drawing.Point(6, 16); + this.LblTVServiceStatusDesc.Name = "LblTVServiceStatusDesc"; + this.LblTVServiceStatusDesc.Size = new System.Drawing.Size(63, 13); + this.LblTVServiceStatusDesc.TabIndex = 0; + this.LblTVServiceStatusDesc.Text = "TV Service:"; + // + // LblMPWWebsiteLink + // + this.LblMPWWebsiteLink.AutoSize = true; + this.LblMPWWebsiteLink.Location = new System.Drawing.Point(6, 16); + this.LblMPWWebsiteLink.Name = "LblMPWWebsiteLink"; + this.LblMPWWebsiteLink.Size = new System.Drawing.Size(92, 13); + this.LblMPWWebsiteLink.TabIndex = 4; + this.LblMPWWebsiteLink.Text = "MPW Homepage:"; + // + // LLblMPWWebsiteLink + // + this.LLblMPWWebsiteLink.AutoSize = true; + this.LLblMPWWebsiteLink.Location = new System.Drawing.Point(104, 16); + this.LLblMPWWebsiteLink.Name = "LLblMPWWebsiteLink"; + this.LLblMPWWebsiteLink.Size = new System.Drawing.Size(166, 13); + this.LLblMPWWebsiteLink.TabIndex = 3; + this.LLblMPWWebsiteLink.TabStop = true; + this.LLblMPWWebsiteLink.Text = "http://www.mp-webinterface.com"; + this.LLblMPWWebsiteLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LLblMPWWebsiteLink_LinkClicked); + // + // gBxMPWWebServerSetup + // + this.gBxMPWWebServerSetup.Controls.Add(this.saveButton); + this.gBxMPWWebServerSetup.Controls.Add(this.bindIPBox); + this.gBxMPWWebServerSetup.Controls.Add(this.accessModeDropDown); + this.gBxMPWWebServerSetup.Controls.Add(this.LblSetupAccessMode); + this.gBxMPWWebServerSetup.Controls.Add(this.LblSetupBindLocalIP); + this.gBxMPWWebServerSetup.Controls.Add(this.portBox); + this.gBxMPWWebServerSetup.Controls.Add(this.LblSetupWebserverPort); + this.gBxMPWWebServerSetup.Location = new System.Drawing.Point(318, 12); + this.gBxMPWWebServerSetup.Name = "gBxMPWWebServerSetup"; + this.gBxMPWWebServerSetup.Size = new System.Drawing.Size(300, 314); + this.gBxMPWWebServerSetup.TabIndex = 1; + this.gBxMPWWebServerSetup.TabStop = false; + this.gBxMPWWebServerSetup.Text = "MPW Webserver setup"; + // + // saveButton + // + this.saveButton.Location = new System.Drawing.Point(126, 132); + this.saveButton.Name = "saveButton"; + this.saveButton.Size = new System.Drawing.Size(115, 23); + this.saveButton.TabIndex = 10; + this.saveButton.Text = "Save Configuration"; + this.saveButton.UseVisualStyleBackColor = true; + this.saveButton.Click += new System.EventHandler(this.saveButton_Click); + // + // bindIPBox + // + this.bindIPBox.Location = new System.Drawing.Point(126, 59); + this.bindIPBox.Name = "bindIPBox"; + this.bindIPBox.Size = new System.Drawing.Size(115, 20); + this.bindIPBox.TabIndex = 9; + // + // accessModeDropDown + // + this.accessModeDropDown.FormattingEnabled = true; + this.accessModeDropDown.Items.AddRange(new object[] { "Local", "Global", "Restricted"}); - this.accessModeDropDown.Location = new System.Drawing.Point(126, 94); - this.accessModeDropDown.Name = "accessModeDropDown"; - this.accessModeDropDown.Size = new System.Drawing.Size(115, 21); - this.accessModeDropDown.TabIndex = 8; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(6, 102); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(74, 13); - this.label9.TabIndex = 7; - this.label9.Text = "Access mode:"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(6, 67); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(81, 13); - this.label8.TabIndex = 6; - this.label8.Text = "Bind to local IP:"; - // - // linkLabel2 - // - this.linkLabel2.AutoSize = true; - this.linkLabel2.Location = new System.Drawing.Point(82, 262); - this.linkLabel2.Name = "linkLabel2"; - this.linkLabel2.Size = new System.Drawing.Size(0, 13); - this.linkLabel2.TabIndex = 5; - this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked); - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(9, 263); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(66, 13); - this.label7.TabIndex = 4; - this.label7.Text = "Server URL:"; - // - // portBox - // - this.portBox.Location = new System.Drawing.Point(126, 32); - this.portBox.Name = "portBox"; - this.portBox.Size = new System.Drawing.Size(115, 20); - this.portBox.TabIndex = 1; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(6, 35); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(114, 13); - this.label4.TabIndex = 0; - this.label4.Text = "MPW Webserver Port:"; - // - // startstopButton - // - this.startstopButton.Location = new System.Drawing.Point(9, 37); - this.startstopButton.Name = "startstopButton"; - this.startstopButton.Size = new System.Drawing.Size(100, 23); - this.startstopButton.TabIndex = 3; - this.startstopButton.Text = "Start"; - this.startstopButton.UseVisualStyleBackColor = true; - this.startstopButton.Click += new System.EventHandler(this.startstopButton_Click); - // - // groupBox3 - // - this.groupBox3.Controls.Add(this.button1); - this.groupBox3.Controls.Add(this.label6); - this.groupBox3.Controls.Add(this.linkLabel1); - this.groupBox3.Controls.Add(this.startstopButton); - this.groupBox3.Location = new System.Drawing.Point(12, 157); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(300, 138); - this.groupBox3.TabIndex = 2; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "MPW Webserver Control"; - // - // button1 - // - this.button1.Location = new System.Drawing.Point(142, 37); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(83, 23); - this.button1.TabIndex = 5; - this.button1.Text = "Refresh status"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // trayIcon - // - this.trayIcon.ContextMenuStrip = this.trayContextMenu; - this.trayIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("trayIcon.Icon"))); - this.trayIcon.Text = "MPW"; - this.trayIcon.Visible = true; - this.trayIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.trayIcon_MouseDoubleClick); - // - // trayContextMenu - // - this.trayContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.accessModeDropDown.Location = new System.Drawing.Point(126, 94); + this.accessModeDropDown.Name = "accessModeDropDown"; + this.accessModeDropDown.Size = new System.Drawing.Size(115, 21); + this.accessModeDropDown.TabIndex = 8; + // + // LblSetupAccessMode + // + this.LblSetupAccessMode.AutoSize = true; + this.LblSetupAccessMode.Location = new System.Drawing.Point(6, 102); + this.LblSetupAccessMode.Name = "LblSetupAccessMode"; + this.LblSetupAccessMode.Size = new System.Drawing.Size(74, 13); + this.LblSetupAccessMode.TabIndex = 7; + this.LblSetupAccessMode.Text = "Access mode:"; + // + // LblSetupBindLocalIP + // + this.LblSetupBindLocalIP.AutoSize = true; + this.LblSetupBindLocalIP.Location = new System.Drawing.Point(6, 67); + this.LblSetupBindLocalIP.Name = "LblSetupBindLocalIP"; + this.LblSetupBindLocalIP.Size = new System.Drawing.Size(81, 13); + this.LblSetupBindLocalIP.TabIndex = 6; + this.LblSetupBindLocalIP.Text = "Bind to local IP:"; + // + // portBox + // + this.portBox.Location = new System.Drawing.Point(126, 32); + this.portBox.Name = "portBox"; + this.portBox.Size = new System.Drawing.Size(115, 20); + this.portBox.TabIndex = 1; + // + // LblSetupWebserverPort + // + this.LblSetupWebserverPort.AutoSize = true; + this.LblSetupWebserverPort.Location = new System.Drawing.Point(6, 35); + this.LblSetupWebserverPort.Name = "LblSetupWebserverPort"; + this.LblSetupWebserverPort.Size = new System.Drawing.Size(114, 13); + this.LblSetupWebserverPort.TabIndex = 0; + this.LblSetupWebserverPort.Text = "MPW Webserver Port:"; + // + // LLblMPWServerURL + // + this.LLblMPWServerURL.AutoSize = true; + this.LLblMPWServerURL.Location = new System.Drawing.Point(78, 51); + this.LLblMPWServerURL.Name = "LLblMPWServerURL"; + this.LLblMPWServerURL.Size = new System.Drawing.Size(0, 13); + this.LLblMPWServerURL.TabIndex = 5; + this.LLblMPWServerURL.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LLblMPWServerURL_LinkClicked); + // + // LblServerURL + // + this.LblServerURL.AutoSize = true; + this.LblServerURL.Location = new System.Drawing.Point(6, 51); + this.LblServerURL.Name = "LblServerURL"; + this.LblServerURL.Size = new System.Drawing.Size(66, 13); + this.LblServerURL.TabIndex = 4; + this.LblServerURL.Text = "Server URL:"; + // + // startstopButton + // + this.startstopButton.Location = new System.Drawing.Point(6, 19); + this.startstopButton.Name = "startstopButton"; + this.startstopButton.Size = new System.Drawing.Size(199, 23); + this.startstopButton.TabIndex = 3; + this.startstopButton.Text = "Start"; + this.startstopButton.UseVisualStyleBackColor = true; + this.startstopButton.Click += new System.EventHandler(this.startstopButton_Click); + // + // gBxMPWWebServer + // + this.gBxMPWWebServer.Controls.Add(this.CmdRefreshStatusInfo); + this.gBxMPWWebServer.Controls.Add(this.startstopButton); + this.gBxMPWWebServer.Controls.Add(this.LblServerURL); + this.gBxMPWWebServer.Controls.Add(this.LLblMPWServerURL); + this.gBxMPWWebServer.Location = new System.Drawing.Point(12, 98); + this.gBxMPWWebServer.Name = "gBxMPWWebServer"; + this.gBxMPWWebServer.Size = new System.Drawing.Size(300, 78); + this.gBxMPWWebServer.TabIndex = 2; + this.gBxMPWWebServer.TabStop = false; + this.gBxMPWWebServer.Text = "MPW Webserver"; + // + // CmdRefreshStatusInfo + // + this.CmdRefreshStatusInfo.Location = new System.Drawing.Point(211, 19); + this.CmdRefreshStatusInfo.Name = "CmdRefreshStatusInfo"; + this.CmdRefreshStatusInfo.Size = new System.Drawing.Size(83, 23); + this.CmdRefreshStatusInfo.TabIndex = 5; + this.CmdRefreshStatusInfo.Text = "Refresh status"; + this.CmdRefreshStatusInfo.UseVisualStyleBackColor = true; + this.CmdRefreshStatusInfo.Click += new System.EventHandler(this.CmdRefreshStatusInfo_Click); + // + // trayIcon + // + this.trayIcon.ContextMenuStrip = this.trayContextMenu; + this.trayIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("trayIcon.Icon"))); + this.trayIcon.Text = "MPW"; + this.trayIcon.Visible = true; + this.trayIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.trayIcon_MouseDoubleClick); + // + // trayContextMenu + // + this.trayContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.trayStart, this.stopToolStripMenuItem, this.exitToolStripMenuItem}); - this.trayContextMenu.Name = "trayContextMenu"; - this.trayContextMenu.Size = new System.Drawing.Size(110, 70); - this.trayContextMenu.Text = "MPW"; - // - // trayStart - // - this.trayStart.Name = "trayStart"; - this.trayStart.Size = new System.Drawing.Size(109, 22); - this.trayStart.Text = "Start"; - this.trayStart.Click += new System.EventHandler(this.trayStart_Click); - // - // stopToolStripMenuItem - // - this.stopToolStripMenuItem.Name = "stopToolStripMenuItem"; - this.stopToolStripMenuItem.Size = new System.Drawing.Size(109, 22); - this.stopToolStripMenuItem.Text = "Stop"; - this.stopToolStripMenuItem.Click += new System.EventHandler(this.stopToolStripMenuItem_Click); - // - // exitToolStripMenuItem - // - this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(109, 22); - this.exitToolStripMenuItem.Text = "Exit"; - this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); - // - // refreshTimer - // - this.refreshTimer.Enabled = true; - this.refreshTimer.Interval = 1000; - this.refreshTimer.Tick += new System.EventHandler(this.refreshTimer_Tick); - // - // Control_Center_App - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(632, 307); - this.Controls.Add(this.groupBox3); - this.Controls.Add(this.groupBox2); - this.Controls.Add(this.groupBox1); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximizeBox = false; - this.Name = "Control_Center_App"; - this.Text = "MPW Control Center"; - this.Resize += new System.EventHandler(this.Control_Center_App_Resize); - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Control_Center_App_FormClosing); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); - this.trayContextMenu.ResumeLayout(false); - this.ResumeLayout(false); + this.trayContextMenu.Name = "trayContextMenu"; + this.trayContextMenu.Size = new System.Drawing.Size(99, 70); + this.trayContextMenu.Text = "MPW"; + // + // trayStart + // + this.trayStart.Name = "trayStart"; + this.trayStart.Size = new System.Drawing.Size(98, 22); + this.trayStart.Text = "Start"; + this.trayStart.Click += new System.EventHandler(this.trayStart_Click); + // + // stopToolStripMenuItem + // + this.stopToolStripMenuItem.Name = "stopToolStripMenuItem"; + this.stopToolStripMenuItem.Size = new System.Drawing.Size(98, 22); + this.stopToolStripMenuItem.Text = "Stop"; + this.stopToolStripMenuItem.Click += new System.EventHandler(this.stopToolStripMenuItem_Click); + // + // exitToolStripMenuItem + // + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.Size = new System.Drawing.Size(98, 22); + this.exitToolStripMenuItem.Text = "Exit"; + this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); + // + // refreshTimer + // + this.refreshTimer.Enabled = true; + this.refreshTimer.Interval = 1000; + this.refreshTimer.Tick += new System.EventHandler(this.refreshTimer_Tick); + // + // gBxAboutMPW + // + this.gBxAboutMPW.Controls.Add(this.LLblMPWWebsiteLink); + this.gBxAboutMPW.Controls.Add(this.LblMPWWebsiteLink); + this.gBxAboutMPW.Location = new System.Drawing.Point(12, 332); + this.gBxAboutMPW.Name = "gBxAboutMPW"; + this.gBxAboutMPW.Size = new System.Drawing.Size(606, 38); + this.gBxAboutMPW.TabIndex = 3; + this.gBxAboutMPW.TabStop = false; + this.gBxAboutMPW.Text = "About MPW"; + // + // gBxVersion + // + this.gBxVersion.Controls.Add(this.LblMPWServiceVersion); + this.gBxVersion.Controls.Add(this.LblMPWServiceVersionDesc); + this.gBxVersion.Controls.Add(this.LblMPWWebserverVersion); + this.gBxVersion.Controls.Add(this.LblMPWWebserverVersionDesc); + this.gBxVersion.Controls.Add(this.LblMPWCCVersion); + this.gBxVersion.Controls.Add(this.LblMPWCCVersionDesc); + this.gBxVersion.Location = new System.Drawing.Point(12, 182); + this.gBxVersion.Name = "gBxVersion"; + this.gBxVersion.Size = new System.Drawing.Size(300, 84); + this.gBxVersion.TabIndex = 4; + this.gBxVersion.TabStop = false; + this.gBxVersion.Text = "Version Information"; + // + // LblMPWServiceVersion + // + this.LblMPWServiceVersion.AutoSize = true; + this.LblMPWServiceVersion.Location = new System.Drawing.Point(135, 61); + this.LblMPWServiceVersion.Name = "LblMPWServiceVersion"; + this.LblMPWServiceVersion.Size = new System.Drawing.Size(112, 13); + this.LblMPWServiceVersion.TabIndex = 5; + this.LblMPWServiceVersion.Text = "Error obtaining version"; + // + // LblMPWServiceVersionDesc + // + this.LblMPWServiceVersionDesc.AutoSize = true; + this.LblMPWServiceVersionDesc.Location = new System.Drawing.Point(6, 61); + this.LblMPWServiceVersionDesc.Name = "LblMPWServiceVersionDesc"; + this.LblMPWServiceVersionDesc.Size = new System.Drawing.Size(123, 13); + this.LblMPWServiceVersionDesc.TabIndex = 4; + this.LblMPWServiceVersionDesc.Text = "MPW Windows Service:"; + // + // LblMPWWebserverVersion + // + this.LblMPWWebserverVersion.AutoSize = true; + this.LblMPWWebserverVersion.Location = new System.Drawing.Point(135, 38); + this.LblMPWWebserverVersion.Name = "LblMPWWebserverVersion"; + this.LblMPWWebserverVersion.Size = new System.Drawing.Size(112, 13); + this.LblMPWWebserverVersion.TabIndex = 3; + this.LblMPWWebserverVersion.Text = "Error obtaining version"; + // + // LblMPWWebserverVersionDesc + // + this.LblMPWWebserverVersionDesc.AutoSize = true; + this.LblMPWWebserverVersionDesc.Location = new System.Drawing.Point(6, 38); + this.LblMPWWebserverVersionDesc.Name = "LblMPWWebserverVersionDesc"; + this.LblMPWWebserverVersionDesc.Size = new System.Drawing.Size(92, 13); + this.LblMPWWebserverVersionDesc.TabIndex = 2; + this.LblMPWWebserverVersionDesc.Text = "MPW Webserver:"; + // + // LblMPWCCVersion + // + this.LblMPWCCVersion.AutoSize = true; + this.LblMPWCCVersion.Location = new System.Drawing.Point(135, 16); + this.LblMPWCCVersion.Name = "LblMPWCCVersion"; + this.LblMPWCCVersion.Size = new System.Drawing.Size(112, 13); + this.LblMPWCCVersion.TabIndex = 1; + this.LblMPWCCVersion.Text = "Error obtaining version"; + // + // LblMPWCCVersionDesc + // + this.LblMPWCCVersionDesc.AutoSize = true; + this.LblMPWCCVersionDesc.Location = new System.Drawing.Point(6, 16); + this.LblMPWCCVersionDesc.Name = "LblMPWCCVersionDesc"; + this.LblMPWCCVersionDesc.Size = new System.Drawing.Size(107, 13); + this.LblMPWCCVersionDesc.TabIndex = 0; + this.LblMPWCCVersionDesc.Text = "MPW Control Center:"; + // + // gBxLogs + // + this.gBxLogs.Controls.Add(this.CmdOpenAccessLog); + this.gBxLogs.Controls.Add(this.CmdOpenEventViewer); + this.gBxLogs.Location = new System.Drawing.Point(12, 272); + this.gBxLogs.Name = "gBxLogs"; + this.gBxLogs.Size = new System.Drawing.Size(300, 54); + this.gBxLogs.TabIndex = 5; + this.gBxLogs.TabStop = false; + this.gBxLogs.Text = "Logs"; + // + // CmdOpenAccessLog + // + this.CmdOpenAccessLog.Location = new System.Drawing.Point(154, 19); + this.CmdOpenAccessLog.Name = "CmdOpenAccessLog"; + this.CmdOpenAccessLog.Size = new System.Drawing.Size(140, 23); + this.CmdOpenAccessLog.TabIndex = 1; + this.CmdOpenAccessLog.Text = "MPW Access Log"; + this.CmdOpenAccessLog.UseVisualStyleBackColor = true; + this.CmdOpenAccessLog.Click += new System.EventHandler(this.CmdOpenAccessLog_Click); + // + // CmdOpenEventViewer + // + this.CmdOpenEventViewer.Location = new System.Drawing.Point(6, 19); + this.CmdOpenEventViewer.Name = "CmdOpenEventViewer"; + this.CmdOpenEventViewer.Size = new System.Drawing.Size(142, 23); + this.CmdOpenEventViewer.TabIndex = 0; + this.CmdOpenEventViewer.Text = "MPW General Logs"; + this.CmdOpenEventViewer.UseVisualStyleBackColor = true; + this.CmdOpenEventViewer.Click += new System.EventHandler(this.CmdOpenEventViewer_Click); + // + // Control_Center_App + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(632, 384); + this.Controls.Add(this.gBxLogs); + this.Controls.Add(this.gBxAboutMPW); + this.Controls.Add(this.gBxMPWWebServer); + this.Controls.Add(this.gBxVersion); + this.Controls.Add(this.gBxMPWWebServerSetup); + this.Controls.Add(this.gBxStatus); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.Name = "Control_Center_App"; + this.Text = "MPW Control Center"; + this.Resize += new System.EventHandler(this.Control_Center_App_Resize); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Control_Center_App_FormClosing); + this.gBxStatus.ResumeLayout(false); + this.gBxStatus.PerformLayout(); + this.gBxMPWWebServerSetup.ResumeLayout(false); + this.gBxMPWWebServerSetup.PerformLayout(); + this.gBxMPWWebServer.ResumeLayout(false); + this.gBxMPWWebServer.PerformLayout(); + this.trayContextMenu.ResumeLayout(false); + this.gBxAboutMPW.ResumeLayout(false); + this.gBxAboutMPW.PerformLayout(); + this.gBxVersion.ResumeLayout(false); + this.gBxVersion.PerformLayout(); + this.gBxLogs.ResumeLayout(false); + this.ResumeLayout(false); } #endregion - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.LinkLabel linkLabel1; - private System.Windows.Forms.Label label3; + private System.Windows.Forms.GroupBox gBxStatus; + private System.Windows.Forms.GroupBox gBxMPWWebServerSetup; + private System.Windows.Forms.Label LblTVServiceStatusDesc; + private System.Windows.Forms.Label LblTVServerConnStatusDesc; + private System.Windows.Forms.LinkLabel LLblMPWWebsiteLink; + private System.Windows.Forms.Label LblMPWWebServerStatusDesc; private System.Windows.Forms.TextBox portBox; - private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label LblSetupWebserverPort; private System.Windows.Forms.Button startstopButton; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.LinkLabel linkLabel2; - private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label LblMPWWebsiteLink; + private System.Windows.Forms.LinkLabel LLblMPWServerURL; + private System.Windows.Forms.Label LblServerURL; private System.Windows.Forms.Label statusTVServerConn; private System.Windows.Forms.Label statusMPWServerConn; private System.Windows.Forms.Label statusTVService; private System.Windows.Forms.ComboBox accessModeDropDown; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label LblSetupAccessMode; + private System.Windows.Forms.Label LblSetupBindLocalIP; private System.Windows.Forms.TextBox bindIPBox; private System.Windows.Forms.Button saveButton; - private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.GroupBox gBxMPWWebServer; private System.Windows.Forms.NotifyIcon trayIcon; private System.Windows.Forms.ContextMenuStrip trayContextMenu; private System.Windows.Forms.ToolStripMenuItem trayStart; private System.Windows.Forms.ToolStripMenuItem stopToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; - private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button CmdRefreshStatusInfo; private System.Windows.Forms.Timer refreshTimer; + private System.Windows.Forms.GroupBox gBxAboutMPW; + private System.Windows.Forms.GroupBox gBxVersion; + private System.Windows.Forms.Label LblMPWServiceVersion; + private System.Windows.Forms.Label LblMPWServiceVersionDesc; + private System.Windows.Forms.Label LblMPWWebserverVersion; + private System.Windows.Forms.Label LblMPWWebserverVersionDesc; + private System.Windows.Forms.Label LblMPWCCVersion; + private System.Windows.Forms.Label LblMPWCCVersionDesc; + private System.Windows.Forms.GroupBox gBxLogs; + private System.Windows.Forms.Button CmdOpenEventViewer; + private System.Windows.Forms.Button CmdOpenAccessLog; } } Modified: trunk/Version2/Control Center/Control_Center_App.cs =================================================================== --- trunk/Version2/Control Center/Control_Center_App.cs 2007-03-09 22:37:29 UTC (rev 34) +++ trunk/Version2/Control Center/Control_Center_App.cs 2007-03-11 10:11:22 UTC (rev 35) @@ -18,20 +18,54 @@ private ServiceController MPWServiceController = new ServiceController("MPW"); //MPW Webserver settings - private String port; + private int port; private String bindIP; private int accesMode; - private String file; + private String configFile; + private bool exitRequested; + public Control_Center_App() { InitializeComponent(); - file = System.AppDomain.CurrentDomain.BaseDirectory + "Configuration.xml"; + configFile = System.AppDomain.CurrentDomain.BaseDirectory + "Configuration.xml"; RefreshControllers(); LoadSettings(); + + LoadVersionInfo(); } + /// <summary> + /// gets version info for MPW components and puts it on labels on form + /// </summary> + private void LoadVersionInfo() + { + LblMPWCCVersion.Text = System.Reflection.Assembly.GetCallingAssembly().GetName().Version.ToString(); + + string fileName; + + try + { + fileName = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "WebServer.dll"); + LblMPWWebserverVersion.Text = System.Diagnostics.FileVersionInfo.GetVersionInfo(fileName).ProductVersion; + } + catch + { } + + try + { + fileName = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "MPW Service.exe"); + LblMPWServiceVersion.Text = System.Diagnostics.FileVersionInfo.GetVersionInfo(fileName).ProductVersion; + } + catch + { } + + } + + /// <summary> + /// refreshes the status indicators for MPW webserver and TV services + /// </summary> private void RefreshControllers() { //MPW Webserver @@ -39,37 +73,39 @@ try { statusMPWServerConn.Text = MPWServiceController.Status.ToString(); + + if (MPWServiceController.Status == ServiceControllerStatus.Running) + { + statusMPWServerConn.ForeColor = Color.Green; + startstopButton.Text = "Stop"; + } + else + { + statusMPWServerConn.ForeColor = Color.Red; + startstopButton.Text = "Start"; + } } catch { statusMPWServerConn.Text = "Error: Service not found!"; startstopButton.Enabled = false; } - if (statusMPWServerConn.Text == "Running") - { - statusMPWServerConn.ForeColor = Color.Green; - startstopButton.Text = "Stop"; - } - else - { - statusMPWServerConn.ForeColor = Color.Red; - startstopButton.Text = "Start"; - } - + //TV Server TVServiceController.Refresh(); try { statusTVService.Text = TVServiceController.Status.ToString(); + + if (TVServiceController.Status == ServiceControllerStatus.Running) + statusTVService.ForeColor = Color.Green; + else + statusTVService.ForeColor = Color.Red; } catch { statusTVService.Text = "Error: Service not found!"; - } - if (statusTVService.Text == "Running") - statusTVService.ForeColor = Color.Green; - else - statusTVService.ForeColor = Color.Red; + } } private void startstopButton_Click(object sender, EventArgs e) @@ -80,17 +116,19 @@ Stop(); } - private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + private void LLblMPWWebsiteLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - System.Diagnostics.Process.Start(linkLabel1.Text); + System.Diagnostics.Process.Start(LLblMPWWebsiteLink.Text); } - private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + private void LLblMPWServerURL_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - System.Diagnostics.Process.Start(linkLabel2.Text); + System.Diagnostics.Process.Start(LLblMPWServerURL.Text); } - //Start the server + /// <summary> + /// Start the server + /// </summary> private void Start() { RefreshControllers(); @@ -106,11 +144,13 @@ RefreshControllers(); } - //Stop the server + /// <summary> + /// Stop the server + /// </summary> private void Stop() { RefreshControllers(); - if (statusMPWServerConn.Text == "Running") + if (MPWServiceController.Status == ServiceControllerStatus.Running) { MPWServiceController.Stop(); startstopButton.Text = "Start"; @@ -118,56 +158,104 @@ RefreshControllers(); } - //Build a String with the server URL + /// <summary> + /// Build a string with the server URL + /// </summary> + /// <returns>server URL</returns> private String ConstructServerURL() { String url = "http://"; url += bindIP; - url += ":" + port; + url += ":" + port.ToString(); url += "/"; return url; } - //Load the configuration - private void LoadSettings() + /// <summary> + /// Load the configuration + /// </summary> + /// <returns>true if settings loaded successfully</returns> + private bool LoadSettings() { - XmlDocument doc = new XmlDocument(); - doc.Load(file); - XmlNode node = doc.DocumentElement.SelectSingleNode("/configuration/bindAddress"); - bindIP = node.InnerText; - node = doc.DocumentElement.SelectSingleNode("/configuration/port"); - port = node.InnerText; - node = doc.DocumentElement.SelectSingleNode("/configuration/allowedAccesMode"); - accesMode = int.Parse(node.InnerText); + try + { + XmlDocument doc = new XmlDocument(); + doc.Load(configFile); + XmlNode node = doc.DocumentElement.SelectSingleNode("/configuration/bindAddress"); + bindIP = node.InnerText; + node = doc.DocumentElement.SelectSingleNode("/configuration/port"); + port = int.Parse(node.InnerText); + node = doc.DocumentElement.SelectSingleNode("/configuration/allowedAccesMode"); + accesMode = int.Parse(node.InnerText); + } + catch (Exception ex) + { + MessageBox.Show("An error occurred when trying to load the settings." + Environment.NewLine + Environment.NewLine + ex.ToString(), "Error when loading settings", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } //Set the read values to the various TextBoxes - portBox.Text = port; + portBox.Text = port.ToString(); bindIPBox.Text = bindIP; accessModeDropDown.SelectedIndex = accesMode; - linkLabel2.Text = ConstructServerURL(); + LLblMPWServerURL.Text = ConstructServerURL(); + + return true; } - //Save the configuration - private void SaveSettings() + /// <summary> + /// save server configuration settings + /// </summary> + /// <returns>true if configuration settings were successfully saved.</returns> + private bool SaveSettings() { - XmlDocument doc = new XmlDocument(); - doc.Load(file); + try + { + XmlDocument doc = new XmlDocument(); + doc.Load(configFile); - XmlNode node = doc.DocumentElement.SelectSingleNode("/configuration/bindAddress"); - node.InnerText = bindIP; - node = doc.DocumentElement.SelectSingleNode("/configuration/port"); - node.InnerText = port; - node = doc.DocumentElement.SelectSingleNode("/configuration/allowedAccesMode"); - node.InnerText = accesMode.ToString(); - node = doc.DocumentElement.SelectSingleNode("/configuration/physicalPath"); - node.InnerText = System.AppDomain.CurrentDomain.BaseDirectory + @"wwwroot\"; + XmlNode node = doc.DocumentElement.SelectSingleNode("/configuration/bindAddress"); + node.InnerText = bindIP; + node = doc.DocumentElement.SelectSingleNode("/configuration/port"); + node.InnerText = port.ToString(); + node = doc.DocumentElement.SelectSingleNode("/configuration/allowedAccesMode"); + node.InnerText = accesMode.ToString(); + node = doc.DocumentElement.SelectSingleNode("/configuration/physicalPath"); + node.InnerText = System.AppDomain.CurrentDomain.BaseDirectory + @"wwwroot\"; - doc.Save(file); + doc.Save(configFile); + } + catch (Exception ex) + { + MessageBox.Show("An error occurred when trying to save the settings." + Environment.NewLine + Environment.NewLine + ex.ToString(), "Error when saving settings", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + + return true; } + /// <summary> + /// save configuration changes and reload configuration for server + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> private void saveButton_Click(object sender, EventArgs e) { - port = portBox.Text; + //data validation + if (!int.TryParse(portBox.Text,out port)) + { + MessageBox.Show("The port number must be numerical only.", "Invalid port number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } + + System.Net.IPAddress bindIPAddress; + if (!System.Net.IPAddress.TryParse(bindIPBox.Text, out bindIPAddress)) + { + MessageBox.Show("The bind IP address is not valid. It must be in the form of xxx.xxx.xxx.xxx, where x is a number.", "Invalid bind IP address", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } + + //port = portBox.Text; //already set if valid from TryParse bindIP = bindIPBox.Text; accesMode = accessModeDropDown.SelectedIndex; SaveSettings(); @@ -182,10 +270,14 @@ { MessageBox.Show("Error setting the new configuration."); } - linkLabel2.Text = ConstructServerURL(); + LLblMPWServerURL.Text = ConstructServerURL(); } - //Restore by double-clicking the tray icon + /// <summary> + /// Restore by double-clicking the tray icon + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> private void trayIcon_MouseDoubleClick(object sender, MouseEventArgs e) { this.WindowState = System.Windows.Forms.FormWindowState.Normal; @@ -194,52 +286,110 @@ RefreshControllers(); } - //Minimize to tray on closing + /// <summary> + /// Minimize to tray on closing + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> private void Control_Center_App_FormClosing(object sender, FormClosingEventArgs e) { - e.Cancel = true; - this.WindowState = System.Windows.Forms.FormWindowState.Minimized; - this.ShowInTaskbar = false; + if (!exitRequested) + { + e.Cancel = true; + this.WindowState = System.Windows.Forms.FormWindowState.Minimized; + this.ShowInTaskbar = false; + } } - //Tray menu action "Exit" + /// <summary> + /// Tray menu action "Exit" + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> private void exitToolStripMenuItem_Click(object sender, EventArgs e) { - trayIcon.Dispose(); - this.Dispose(); + exitRequested = true; + this.Close(); } - //Tray menu action "Stop" + /// <summary> + /// Tray menu action "Stop" + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> private void stopToolStripMenuItem_Click(object sender, EventArgs e) { Start(); } - //Tray menu action "Start" + /// <summary> + /// Tray menu action "Start" + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> private void trayStart_Click(object sender, EventArgs e) { Stop(); } - //Status refreh button - private void button1_Click(object sender, EventArgs e) + /// <summary> + /// Status refresh button + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void CmdRefreshStatusInfo_Click(object sender, EventArgs e) { RefreshControllers(); } - //Minimize to tray on minimize + /// <summary> + /// Minimize to tray on minimize + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> private void Control_Center_App_Resize(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) this.ShowInTaskbar = false; } - //Update the Service status + /// <summary> + /// Update the Service status + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> private void refreshTimer_Tick(object sender, EventArgs e) { if (this.WindowState != System.Windows.Forms.FormWindowState.Minimized) RefreshControllers(); } + /// <summary> + /// Open Windows Event Viewer for user to browse logs + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void CmdOpenEventViewer_Click(object sender, EventArgs e) + { + string fileName = System.IO.Path.Combine(Environment.SystemDirectory, "eventvwr.msc"); + System.Diagnostics.Process.Start(fileName); + } + + /// <summary> + /// Open access log in text editor + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void CmdOpenAccessLog_Click(object sender, EventArgs e) + { + string fileName; + fileName = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "access.log"); + + if (System.IO.File.Exists(fileName)) + System.Diagnostics.Process.Start(fileName); + else + MessageBox.Show("No access log file cound be found, most likely because no attempts of accessing MPW have been made.", "Access log not found", MessageBoxButtons.OK, MessageBoxIcon.Information); + + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |