From 4fa193d33f32b491c8fd2f5a519814725304113c Mon Sep 17 00:00:00 2001 From: Lee Richardson Date: Wed, 29 Oct 2014 20:24:16 -0400 Subject: [PATCH] Ability to test the siren in the extruder Link to create an account --- .gitignore | 3 +- SirenOfShame.Extruder/BrowserPage.cs | 2 +- SirenOfShame.Extruder/MainForm.cs | 7 ++ .../Services/SosOnlineService.cs | 4 +- .../SettingsPage.Designer.cs | 110 +++++++++--------- SirenOfShame.Extruder/SettingsPage.cs | 6 + .../SirenOfShame.Extruder.csproj | 1 + 7 files changed, 76 insertions(+), 57 deletions(-) diff --git a/.gitignore b/.gitignore index 082ce793..71755d5a 100644 --- a/.gitignore +++ b/.gitignore @@ -106,4 +106,5 @@ Desktop.ini ## wyBuild ############ -Releases/Updates \ No newline at end of file +Releases/Updates +/SirenOfShame.Extruder/Services/MySosOnlineService.cs diff --git a/SirenOfShame.Extruder/BrowserPage.cs b/SirenOfShame.Extruder/BrowserPage.cs index 328655df..e50aac92 100644 --- a/SirenOfShame.Extruder/BrowserPage.cs +++ b/SirenOfShame.Extruder/BrowserPage.cs @@ -33,7 +33,7 @@ public void EnsureConnected(ExtruderSettings settings) var asciiEncoding = new ASCIIEncoding(); byte[] credentials = asciiEncoding.GetBytes(credentialsAsString); - const string url = SosOnlineService.SOS_URL + "/Mobile/App"; + string url = SosOnlineService.SOS_URL + "/Mobile/App"; _webBrowser.Navigate(url, null, credentials, "Content-Type: application/x-www-form-urlencoded"); _webBrowser.Url = new Uri(url); } diff --git a/SirenOfShame.Extruder/MainForm.cs b/SirenOfShame.Extruder/MainForm.cs index ba8f0d4b..54845b89 100644 --- a/SirenOfShame.Extruder/MainForm.cs +++ b/SirenOfShame.Extruder/MainForm.cs @@ -56,6 +56,13 @@ private void InitializeSettingsPage() _settingsPage.Settings = _settings; _settingsPage.OnToggleConnection += SettingsPageOnOnToggleConnection; _settingsPage.OnCloseSettings += SettingsPageOnOnCloseSettings; + _settingsPage.OnTestSiren += SettingsPageOnTestSiren; + } + + private void SettingsPageOnTestSiren(object sender, TestSirenEventArgs args) + { + OnSetLights(1, new TimeSpan(0, 0, 10)); + OnSetAudio(1, new TimeSpan(0, 0, 10)); } private void SettingsPageOnOnCloseSettings(object sender, CloseSettingsEventArgs args) diff --git a/SirenOfShame.Extruder/Services/SosOnlineService.cs b/SirenOfShame.Extruder/Services/SosOnlineService.cs index f723580d..de426c1e 100644 --- a/SirenOfShame.Extruder/Services/SosOnlineService.cs +++ b/SirenOfShame.Extruder/Services/SosOnlineService.cs @@ -9,9 +9,9 @@ namespace SirenOfShame.Extruder.Services { - public sealed class SosOnlineService + public sealed partial class SosOnlineService { - public const string SOS_URL = "http://localhost:3115"; + public static string SOS_URL = "http://sirenofshame.com"; private readonly ILog _log = MyLogManager.GetLog(typeof (SosOnlineService)); private HubConnection _connection; private IHubProxy _proxy; diff --git a/SirenOfShame.Extruder/SettingsPage.Designer.cs b/SirenOfShame.Extruder/SettingsPage.Designer.cs index af3291d5..ce84f45a 100644 --- a/SirenOfShame.Extruder/SettingsPage.Designer.cs +++ b/SirenOfShame.Extruder/SettingsPage.Designer.cs @@ -32,15 +32,15 @@ private void InitializeComponent() { this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.panel1 = new System.Windows.Forms.Panel(); - this._close = new SirenOfShame.Extruder.Controls.ExtruderButton(); - this.label4 = new System.Windows.Forms.Label(); - this._testSiren = new SirenOfShame.Extruder.Controls.ExtruderButton(); + this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.label3 = new System.Windows.Forms.Label(); this._myname = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this._password = new System.Windows.Forms.TextBox(); this._username = new System.Windows.Forms.TextBox(); + this._close = new SirenOfShame.Extruder.Controls.ExtruderButton(); + this._testSiren = new SirenOfShame.Extruder.Controls.ExtruderButton(); this._connectButton = new SirenOfShame.Extruder.Controls.ExtruderButton(); this.tableLayoutPanel1.SuspendLayout(); this.panel1.SuspendLayout(); @@ -59,15 +59,15 @@ private void InitializeComponent() this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 130F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 130F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 194F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 194F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(392, 194); this.tableLayoutPanel1.TabIndex = 18; // // panel1 // + this.panel1.Controls.Add(this.linkLabel1); this.panel1.Controls.Add(this._close); - this.panel1.Controls.Add(this.label4); this.panel1.Controls.Add(this._testSiren); this.panel1.Controls.Add(this.label3); this.panel1.Controls.Add(this._myname); @@ -82,52 +82,19 @@ private void InitializeComponent() this.panel1.Size = new System.Drawing.Size(271, 188); this.panel1.TabIndex = 0; // - // _close - // - this._close.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._close.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); - this._close.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(38)))), ((int)(((byte)(39))))); - this._close.FlatAppearance.BorderSize = 0; - this._close.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(186)))), ((int)(((byte)(55)))), ((int)(((byte)(0))))); - this._close.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(196)))), ((int)(((byte)(65)))), ((int)(((byte)(0))))); - this._close.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this._close.ForeColor = System.Drawing.Color.White; - this._close.Location = new System.Drawing.Point(173, 82); - this._close.Name = "_close"; - this._close.Size = new System.Drawing.Size(95, 26); - this._close.TabIndex = 27; - this._close.Text = "Close"; - this._close.UseVisualStyleBackColor = false; - this._close.Click += new System.EventHandler(this._close_Click); - // - // label4 - // - this.label4.ForeColor = System.Drawing.Color.White; - this.label4.Location = new System.Drawing.Point(7, 150); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(62, 20); - this.label4.TabIndex = 26; - this.label4.Text = "Siren"; - this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // linkLabel1 // - // _testSiren - // - this._testSiren.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._testSiren.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); - this._testSiren.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(38)))), ((int)(((byte)(39))))); - this._testSiren.FlatAppearance.BorderSize = 0; - this._testSiren.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(186)))), ((int)(((byte)(55)))), ((int)(((byte)(0))))); - this._testSiren.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(196)))), ((int)(((byte)(65)))), ((int)(((byte)(0))))); - this._testSiren.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this._testSiren.ForeColor = System.Drawing.Color.White; - this._testSiren.Location = new System.Drawing.Point(75, 150); - this._testSiren.Name = "_testSiren"; - this._testSiren.Size = new System.Drawing.Size(193, 23); - this._testSiren.TabIndex = 25; - this._testSiren.Text = "Test Audio + Lights"; - this._testSiren.UseVisualStyleBackColor = false; - this._testSiren.Click += new System.EventHandler(this.TestSiren_Click); + this.linkLabel1.ActiveLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(196)))), ((int)(((byte)(65)))), ((int)(((byte)(0))))); + this.linkLabel1.AutoSize = true; + this.linkLabel1.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(196)))), ((int)(((byte)(65)))), ((int)(((byte)(0))))); + this.linkLabel1.Location = new System.Drawing.Point(72, 120); + this.linkLabel1.Name = "linkLabel1"; + this.linkLabel1.Size = new System.Drawing.Size(106, 13); + this.linkLabel1.TabIndex = 28; + this.linkLabel1.TabStop = true; + this.linkLabel1.Text = "Create New Account"; + this.linkLabel1.VisitedLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(196)))), ((int)(((byte)(65)))), ((int)(((byte)(0))))); + this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.CreateAccount_LinkClicked); // // label3 // @@ -136,7 +103,7 @@ private void InitializeComponent() this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(62, 20); this.label3.TabIndex = 24; - this.label3.Text = "My Name"; + this.label3.Text = "Machine"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // _myname @@ -188,6 +155,43 @@ private void InitializeComponent() this._username.Size = new System.Drawing.Size(193, 20); this._username.TabIndex = 19; // + // _close + // + this._close.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._close.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); + this._close.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(38)))), ((int)(((byte)(39))))); + this._close.FlatAppearance.BorderSize = 0; + this._close.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(186)))), ((int)(((byte)(55)))), ((int)(((byte)(0))))); + this._close.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(196)))), ((int)(((byte)(65)))), ((int)(((byte)(0))))); + this._close.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this._close.ForeColor = System.Drawing.Color.White; + this._close.Location = new System.Drawing.Point(173, 82); + this._close.Name = "_close"; + this._close.Size = new System.Drawing.Size(95, 26); + this._close.TabIndex = 27; + this._close.Text = "Close"; + this._close.UseVisualStyleBackColor = false; + this._close.Click += new System.EventHandler(this._close_Click); + // + // _testSiren + // + this._testSiren.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this._testSiren.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); + this._testSiren.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(38)))), ((int)(((byte)(39))))); + this._testSiren.FlatAppearance.BorderSize = 0; + this._testSiren.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(186)))), ((int)(((byte)(55)))), ((int)(((byte)(0))))); + this._testSiren.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(196)))), ((int)(((byte)(65)))), ((int)(((byte)(0))))); + this._testSiren.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this._testSiren.ForeColor = System.Drawing.Color.White; + this._testSiren.Location = new System.Drawing.Point(75, 150); + this._testSiren.Name = "_testSiren"; + this._testSiren.Size = new System.Drawing.Size(193, 23); + this._testSiren.TabIndex = 25; + this._testSiren.Text = "Test Siren"; + this._testSiren.UseVisualStyleBackColor = false; + this._testSiren.Click += new System.EventHandler(this.TestSiren_Click); + // // _connectButton // this._connectButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -236,7 +240,7 @@ private void InitializeComponent() private System.Windows.Forms.TextBox _username; private ExtruderButton _connectButton; private ExtruderButton _close; - private System.Windows.Forms.Label label4; + private System.Windows.Forms.LinkLabel linkLabel1; } diff --git a/SirenOfShame.Extruder/SettingsPage.cs b/SirenOfShame.Extruder/SettingsPage.cs index 50097db6..e2971b99 100644 --- a/SirenOfShame.Extruder/SettingsPage.cs +++ b/SirenOfShame.Extruder/SettingsPage.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Threading.Tasks; using System.Windows.Forms; using SirenOfShame.Extruder.Models; @@ -90,6 +91,11 @@ private void _close_Click(object sender, EventArgs e) { InvokeOnCloseSettings(); } + + private void CreateAccount_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + Process.Start("http://sirenofshame.com/Account/Register"); + } } public delegate void CloseSettingsEvent(object sender, CloseSettingsEventArgs args); diff --git a/SirenOfShame.Extruder/SirenOfShame.Extruder.csproj b/SirenOfShame.Extruder/SirenOfShame.Extruder.csproj index 5c7911f0..061f9ae7 100644 --- a/SirenOfShame.Extruder/SirenOfShame.Extruder.csproj +++ b/SirenOfShame.Extruder/SirenOfShame.Extruder.csproj @@ -83,6 +83,7 @@ +