From eaeae4d66b3e763ae6fdfac66c76463b369d410e Mon Sep 17 00:00:00 2001 From: Colin Dawson Date: Sat, 24 Apr 2021 13:16:08 +0100 Subject: [PATCH] Combined the skip prompts and set date time code, to just one check box. --- Meade.net.Telescope/Telescope.cs | 61 +++--- .../SharedResourcesUnitTests.cs | 1 - Meade.net/MeadeTelescopeBase.cs | 3 - Meade.net/ProfileProperties.cs | 1 - Meade.net/SetupDialogForm.cs | 4 +- Meade.net/SetupDialogForm.designer.cs | 26 +-- Meade.net/SetupDialogForm.resx | 179 +++++++----------- Meade.net/SharedResources.cs | 4 - 8 files changed, 111 insertions(+), 168 deletions(-) diff --git a/Meade.net.Telescope/Telescope.cs b/Meade.net.Telescope/Telescope.cs index 919fa51..08e8dfd 100644 --- a/Meade.net.Telescope/Telescope.cs +++ b/Meade.net.Telescope/Telescope.cs @@ -419,17 +419,17 @@ namespace ASCOM.Meade.net SetTelescopePrecision("Connect"); - bool setTimeBeforeDisplayBypass = SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS; - if (setTimeBeforeDisplayBypass) + if (SendDateTime) { - BypassHandboxEntryForAutostarII(); - //SendCurrentDateTime("Connect"); - } - else - { - ApplySkipAutoStarPrompts("Connect"); - if (!setTimeBeforeDisplayBypass) + if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS) + { + BypassHandboxEntryForAutostarII(); + } + else + { + ApplySkipAutoStarPrompts("Connect"); SendCurrentDateTime("Connect"); + } } } else @@ -470,33 +470,30 @@ namespace ASCOM.Meade.net private void ApplySkipAutoStarPrompts(string connect) { - if (SkipAutoStarPrompts) + //if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS) + //{ + // var displayText = Action("Handbox", "readdisplay"); + // if (displayText.Contains("Daylight")) + // { + // for (var i = 0; i < 3; i++) + // { + // Action("Handbox", "enter"); + // _utilities.WaitForMilliseconds(2000); + // } + // } + //} + //else if (SharedResourcesWrapper.ProductName == TelescopeList.Autostar497) + //{ + var displayText = Action("Handbox", "readdisplay"); + if (displayText.Contains("Press 0 to Alignor MODE for Menu")) { - if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS) + for (var i = 0; i < 4; i++) { - var displayText = Action("Handbox", "readdisplay"); - if (displayText.Contains("Daylight")) - { - for (var i = 0; i < 3; i++) - { - Action("Handbox", "enter"); - _utilities.WaitForMilliseconds(2000); - } - } - } - else if (SharedResourcesWrapper.ProductName == TelescopeList.Autostar497) - { - var displayText = Action("Handbox", "readdisplay"); - if (displayText.Contains("Press 0 to Alignor MODE for Menu")) - { - for (var i = 0; i < 4; i++) - { - Action("Handbox", "mode"); - _utilities.WaitForMilliseconds(500); - } - } + Action("Handbox", "mode"); + _utilities.WaitForMilliseconds(500); } } + //} } private void SetTelescopePrecision(string propertyName) diff --git a/Meade.net.UnitTests/SharedResourcesUnitTests.cs b/Meade.net.UnitTests/SharedResourcesUnitTests.cs index ec88158..d6888e6 100644 --- a/Meade.net.UnitTests/SharedResourcesUnitTests.cs +++ b/Meade.net.UnitTests/SharedResourcesUnitTests.cs @@ -247,7 +247,6 @@ namespace Meade.net.UnitTests Assert.That(profileProperties.RtsDtrEnabled, Is.EqualTo(bool.Parse(RtsDtrEnabledDefault))); Assert.That(profileProperties.SendDateTime, Is.EqualTo(bool.Parse(SendDateTimeDefault))); - Assert.That(profileProperties.SkipPrompts, Is.EqualTo(bool.Parse(SkipPromptsDefault))); } [TestCase("TCP")] diff --git a/Meade.net/MeadeTelescopeBase.cs b/Meade.net/MeadeTelescopeBase.cs index 3e79993..a923a2a 100644 --- a/Meade.net/MeadeTelescopeBase.cs +++ b/Meade.net/MeadeTelescopeBase.cs @@ -28,7 +28,6 @@ namespace ASCOM.Meade.net protected string GuidingStyle; protected double SiteElevation; protected short ProfileSettleTime; - protected bool SkipAutoStarPrompts; protected bool SendDateTime; protected readonly ISharedResourcesWrapper SharedResourcesWrapper; @@ -71,7 +70,6 @@ namespace ASCOM.Meade.net GuidingStyle = profileProperties.GuidingStyle.ToLower(); SiteElevation = profileProperties.SiteElevation; ProfileSettleTime = profileProperties.SettleTime; - SkipAutoStarPrompts = profileProperties.SkipPrompts; SendDateTime = profileProperties.SendDateTime; LogMessage("ReadProfile", $"Trace logger enabled: {Tl.Enabled}"); @@ -83,7 +81,6 @@ namespace ASCOM.Meade.net LogMessage("ReadProfile", $"Guiding Style: {GuidingStyle}"); LogMessage("ReadProfile", $"Site Elevation: {SiteElevation}"); LogMessage("ReadProfile", $"Settle Time after slew: {ProfileSettleTime}"); - LogMessage("ReadProfile", $"Skip Autostar startup prompts: {SkipAutoStarPrompts}"); LogMessage("ReadProfile", $"Send date and time on connect: {SendDateTime}"); } diff --git a/Meade.net/ProfileProperties.cs b/Meade.net/ProfileProperties.cs index 9c03728..e95c707 100644 --- a/Meade.net/ProfileProperties.cs +++ b/Meade.net/ProfileProperties.cs @@ -20,6 +20,5 @@ namespace ASCOM.Meade.net public int Speed { get; set; } public string Handshake { get; set; } public bool SendDateTime { get; set; } - public bool SkipPrompts { get; set; } } } \ No newline at end of file diff --git a/Meade.net/SetupDialogForm.cs b/Meade.net/SetupDialogForm.cs index 40c753b..af0db74 100644 --- a/Meade.net/SetupDialogForm.cs +++ b/Meade.net/SetupDialogForm.cs @@ -158,7 +158,6 @@ namespace ASCOM.Meade.net nudSettleTime.Value = profileProperties.SettleTime; cbxSendDateTime.Checked = profileProperties.SendDateTime; - cbxSkipPrompts.Checked = profileProperties.SkipPrompts; } public ProfileProperties GetProfile() @@ -181,8 +180,7 @@ namespace ASCOM.Meade.net DynamicBreaking = cbxDynamicBreaking.Checked, SiteElevation = double.Parse(txtElevation.Text), SettleTime = Convert.ToInt16(nudSettleTime.Value), - SendDateTime = cbxSendDateTime.Checked, - SkipPrompts = cbxSkipPrompts.Checked + SendDateTime = cbxSendDateTime.Checked }; return profileProperties; diff --git a/Meade.net/SetupDialogForm.designer.cs b/Meade.net/SetupDialogForm.designer.cs index 2f9e0b7..3e9a255 100644 --- a/Meade.net/SetupDialogForm.designer.cs +++ b/Meade.net/SetupDialogForm.designer.cs @@ -58,6 +58,7 @@ namespace ASCOM.Meade.net this.cbxDynamicBreaking = new System.Windows.Forms.CheckBox(); this.cbxRtsDtr = new System.Windows.Forms.CheckBox(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.cbxSendDateTime = new System.Windows.Forms.CheckBox(); this.label12 = new System.Windows.Forms.Label(); this.txtElevation = new System.Windows.Forms.TextBox(); this.label13 = new System.Windows.Forms.Label(); @@ -75,8 +76,6 @@ namespace ASCOM.Meade.net this.label19 = new System.Windows.Forms.Label(); this.label20 = new System.Windows.Forms.Label(); this.label21 = new System.Windows.Forms.Label(); - this.cbxSkipPrompts = new System.Windows.Forms.CheckBox(); - this.cbxSendDateTime = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.picASCOM)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudSettleTime)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numDatabits)).BeginInit(); @@ -234,6 +233,13 @@ namespace ASCOM.Meade.net this.toolTip1.SetToolTip(this.cbxRtsDtr, resources.GetString("cbxRtsDtr.ToolTip")); this.cbxRtsDtr.UseVisualStyleBackColor = true; // + // cbxSendDateTime + // + resources.ApplyResources(this.cbxSendDateTime, "cbxSendDateTime"); + this.cbxSendDateTime.Name = "cbxSendDateTime"; + this.toolTip1.SetToolTip(this.cbxSendDateTime, resources.GetString("cbxSendDateTime.ToolTip")); + this.cbxSendDateTime.UseVisualStyleBackColor = true; + // // label12 // resources.ApplyResources(this.label12, "label12"); @@ -338,26 +344,11 @@ namespace ASCOM.Meade.net resources.ApplyResources(this.label21, "label21"); this.label21.Name = "label21"; // - // cbxSkipPrompts - // - resources.ApplyResources(this.cbxSkipPrompts, "cbxSkipPrompts"); - this.cbxSkipPrompts.Name = "cbxSkipPrompts"; - this.toolTip1.SetToolTip(this.cbxSkipPrompts, resources.GetString("cbxSkipPrompts.ToolTip")); - this.cbxSkipPrompts.UseVisualStyleBackColor = true; - // - // cbxSendDateTime - // - resources.ApplyResources(this.cbxSendDateTime, "cbxSendDateTime"); - this.cbxSendDateTime.Name = "cbxSendDateTime"; - this.toolTip1.SetToolTip(this.cbxSendDateTime, resources.GetString("cbxSendDateTime.ToolTip")); - this.cbxSendDateTime.UseVisualStyleBackColor = true; - // // SetupDialogForm // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.cbxSendDateTime); - this.Controls.Add(this.cbxSkipPrompts); this.Controls.Add(this.label21); this.Controls.Add(this.label20); this.Controls.Add(this.label19); @@ -458,7 +449,6 @@ namespace ASCOM.Meade.net private Label label19; private Label label20; private Label label21; - private CheckBox cbxSkipPrompts; private CheckBox cbxSendDateTime; } } \ No newline at end of file diff --git a/Meade.net/SetupDialogForm.resx b/Meade.net/SetupDialogForm.resx index 6103062..726e548 100644 --- a/Meade.net/SetupDialogForm.resx +++ b/Meade.net/SetupDialogForm.resx @@ -145,7 +145,7 @@ $this - 42 + 41 Bottom, Right @@ -172,7 +172,7 @@ $this - 41 + 40 12, 9 @@ -196,7 +196,7 @@ $this - 40 + 39 Top, Right @@ -223,7 +223,7 @@ $this - 39 + 38 True @@ -250,7 +250,7 @@ $this - 38 + 37 True @@ -277,7 +277,7 @@ $this - 37 + 36 97, 87 @@ -298,7 +298,7 @@ $this - 36 + 35 True @@ -325,7 +325,7 @@ $this - 35 + 34 375, 166 @@ -355,7 +355,7 @@ $this - 34 + 33 True @@ -382,7 +382,7 @@ $this - 33 + 32 True @@ -409,7 +409,7 @@ $this - 32 + 31 True @@ -436,7 +436,7 @@ $this - 31 + 30 Unchanged @@ -466,7 +466,7 @@ $this - 30 + 29 True @@ -496,7 +496,7 @@ $this - 29 + 28 Auto @@ -526,7 +526,7 @@ $this - 28 + 27 True @@ -556,7 +556,7 @@ $this - 27 + 26 True @@ -589,7 +589,7 @@ $this - 26 + 25 375, 302 @@ -613,7 +613,7 @@ $this - 24 + 23 True @@ -643,7 +643,7 @@ $this - 25 + 24 True @@ -673,7 +673,7 @@ $this - 23 + 22 True @@ -706,7 +706,7 @@ $this - 22 + 21 True @@ -733,7 +733,7 @@ $this - 21 + 20 True @@ -760,7 +760,7 @@ $this - 20 + 19 True @@ -793,7 +793,40 @@ $this - 19 + 18 + + + True + + + NoControl + + + 627, 95 + + + 145, 17 + + + 41 + + + Set current date and time + + + Send Current Date and Time (will also skip the opening dialogs on the LX200GPS) + + + cbxSendDateTime + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 True @@ -820,7 +853,7 @@ $this - 18 + 17 375, 93 @@ -841,7 +874,7 @@ $this - 17 + 16 True @@ -868,7 +901,7 @@ $this - 16 + 15 True @@ -895,7 +928,7 @@ $this - 15 + 14 375, 125 @@ -916,7 +949,7 @@ $this - 14 + 13 True @@ -943,7 +976,7 @@ $this - 13 + 12 True @@ -970,7 +1003,7 @@ $this - 12 + 11 97, 163 @@ -991,7 +1024,7 @@ $this - 11 + 10 97, 137 @@ -1012,7 +1045,7 @@ $this - 10 + 9 97, 190 @@ -1033,7 +1066,7 @@ $this - 9 + 8 97, 217 @@ -1054,7 +1087,7 @@ $this - 8 + 7 97, 244 @@ -1075,7 +1108,7 @@ $this - 7 + 6 True @@ -1102,7 +1135,7 @@ $this - 6 + 5 True @@ -1129,7 +1162,7 @@ $this - 5 + 4 True @@ -1156,7 +1189,7 @@ $this - 4 + 3 True @@ -1183,7 +1216,7 @@ $this - 3 + 2 True @@ -1216,74 +1249,8 @@ $this - 2 - - - True - - - NoControl - - - 615, 96 - - - 113, 17 - - - 40 - - - Skip Date prompts - - - driver will attempt to skip past the date prompts when a connection to the Autostar is made - - - cbxSkipPrompts - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - 1 - - True - - - NoControl - - - 615, 123 - - - 145, 17 - - - 41 - - - Set current date and time - - - Send Current Date and Time - - - cbxSendDateTime - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 0 - True diff --git a/Meade.net/SharedResources.cs b/Meade.net/SharedResources.cs index f84a243..ebcc48c 100644 --- a/Meade.net/SharedResources.cs +++ b/Meade.net/SharedResources.cs @@ -158,7 +158,6 @@ namespace ASCOM.Meade.net private const string StopBitsName = "Stop Bits"; private const string HandShakeName = "Hand Shake"; private const string ParityName = "Parity"; - private const string SkipPromptsName = "Skip date prompts on connect"; private const string SendDateTimeName = "Send Date and time on connect"; public static void WriteProfile(ProfileProperties profileProperties) @@ -184,7 +183,6 @@ namespace ASCOM.Meade.net driverProfile.WriteValue(DriverId, DynamicBreakingName, profileProperties.DynamicBreaking.ToString()); driverProfile.WriteValue(DriverId, SiteElevationName, profileProperties.SiteElevation.ToString(CultureInfo.InvariantCulture)); driverProfile.WriteValue(DriverId, SettleTimeName, profileProperties.SettleTime.ToString()); - driverProfile.WriteValue(DriverId, SkipPromptsName, profileProperties.SkipPrompts.ToString()); driverProfile.WriteValue(DriverId, SendDateTimeName, profileProperties.SendDateTime.ToString()); } } @@ -207,7 +205,6 @@ namespace ASCOM.Meade.net private const string HandShakeDefault = "None"; private const string ParityDefault = "None"; private const string SendDateTimeDefault = "false"; - private const string SkipPromptsDefault = "false"; public static ProfileProperties ReadProfile() { @@ -234,7 +231,6 @@ namespace ASCOM.Meade.net profileProperties.Speed = Convert.ToInt32(driverProfile.GetValue(DriverId, SpeedName, string.Empty, SpeedDefault)); profileProperties.Parity = driverProfile.GetValue(DriverId, ParityName, string.Empty, ParityDefault); profileProperties.SendDateTime = Convert.ToBoolean(driverProfile.GetValue(DriverId, SendDateTimeName, string.Empty, SendDateTimeDefault)); - profileProperties.SkipPrompts = Convert.ToBoolean(driverProfile.GetValue(DriverId, SkipPromptsName, string.Empty, SkipPromptsDefault)); } return profileProperties;