Skip to content

Commit

Permalink
Merge branch 'platform6.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter-Simpson committed Dec 22, 2020
2 parents 6819eca + 629534a commit 7634be0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 16 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
ChkShowDeviceDetails.Checked = chooserForm.AlpacaShowDeviceDetails
NumExtraChooserWidth.Value = Convert.ToDecimal(chooserForm.AlpacaChooserIncrementalWidth)
ChkShowCreateNewAlpacaDriverMessage.Checked = Not GetBool(SUPPRESS_ALPACA_DRIVER_ADMIN_DIALOGUE, SUPPRESS_ALPACA_DRIVER_ADMIN_DIALOGUE_DEFAULT)

ChkMultiThreadedChooser.Checked = chooserForm.AlpacaMultiThreadedChooser
' Set the IP v4 / v6 radio boxes
If chooserForm.AlpacaUseIpV4 And chooserForm.AlpacaUseIpV6 Then '// Both Then IPv4 And v6 are enabled so Set the "both" button
RadIpV4AndV6.Checked = True
Expand All @@ -58,6 +58,7 @@
chooserForm.AlpacaShowDeviceDetails = ChkShowDeviceDetails.Checked
chooserForm.AlpacaChooserIncrementalWidth = Convert.ToInt32(NumExtraChooserWidth.Value)
SetName(SUPPRESS_ALPACA_DRIVER_ADMIN_DIALOGUE, (Not ChkShowCreateNewAlpacaDriverMessage.Checked).ToString())
chooserForm.AlpacaMultiThreadedChooser = ChkMultiThreadedChooser.Checked

' Set the IP v4 And v6 variables as necessary
If (RadIpV4.Checked) Then ' The Then IPv4 radio button Is checked so Set the IP v4 And IP v6 variables accordingly
Expand Down
19 changes: 10 additions & 9 deletions ASCOM.Utilities/ASCOM.Utilities/ChooserForm.vb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ Friend Class ChooserForm

#Region "Constants"

' Debug constants
Private Const DEBUG_SINGLE_THREADING As Boolean = False ' If set TRUE, the Chooser form display will be suppressed until discovery completes, far from ideal, so normally leave FALSE

' General constants
Private Const ALERT_MESSAGEBOX_TITLE As String = "ASCOM Chooser"
Private Const PROPERTIES_TOOLTIP_DISPLAY_TIME As Integer = 5000 ' Time to display the Properties tooltip (milliseconds)
Expand All @@ -43,6 +40,7 @@ Friend Class ChooserForm
Private Const ALPACA_CHOOSER_WIDTH As String = "Alpaca Chooser width" : Private Const ALPACA_CHOOSER_WIDTH_DEFAULT As Integer = 0
Private Const ALPACA_USE_IPV4 As String = "Use IPv4" : Private Const ALPACA_USE_IPV4_DEFAULT As Boolean = True
Private Const ALPACA_USE_IPV6 As String = "Use IPv6" : Private Const ALPACA_USE_IPV6_DEFAULT As Boolean = False
Private Const ALPACA_MULTI_THREADED_CHOOSER As String = "Multi Threaded Chooser" : Private Const ALPACA_MULTI_THREADED_CHOOSER_DEFAULT As Boolean = True

' Alpaca integration constants
Private Const ALPACA_DYNAMIC_CLIENT_MANAGER_RELATIVE_PATH As String = "ASCOM\Platform 6\Tools\AlpacaDynamicClientManager"
Expand Down Expand Up @@ -92,6 +90,7 @@ Friend Class ChooserForm
Friend AlpacaChooserIncrementalWidth As Integer
Friend AlpacaUseIpV4 As Boolean
Friend AlpacaUseIpV6 As Boolean
Friend AlpacaMultiThreadedChooser As Boolean

' Delegates
Private PopulateDriverComboBoxDelegate As MethodInvoker = AddressOf PopulateDriverComboBox ' Device list combo box delegate
Expand Down Expand Up @@ -799,6 +798,7 @@ Friend Class ChooserForm
AlpacaChooserIncrementalWidth = Convert.ToInt32(registryAccess.GetProfile(CONFIGRATION_SUBKEY, ALPACA_CHOOSER_WIDTH, ALPACA_CHOOSER_WIDTH_DEFAULT.ToString()), CultureInfo.InvariantCulture)
AlpacaUseIpV4 = Convert.ToBoolean(registryAccess.GetProfile(CONFIGRATION_SUBKEY, ALPACA_USE_IPV4, ALPACA_USE_IPV4_DEFAULT.ToString()), CultureInfo.InvariantCulture)
AlpacaUseIpV6 = Convert.ToBoolean(registryAccess.GetProfile(CONFIGRATION_SUBKEY, ALPACA_USE_IPV6, ALPACA_USE_IPV6_DEFAULT.ToString()), CultureInfo.InvariantCulture)
AlpacaMultiThreadedChooser = Convert.ToBoolean(registryAccess.GetProfile(CONFIGRATION_SUBKEY, ALPACA_MULTI_THREADED_CHOOSER, ALPACA_MULTI_THREADED_CHOOSER_DEFAULT.ToString()), CultureInfo.InvariantCulture)
Catch ex As Exception
MsgBox("Chooser Read State " & ex.ToString)
LogEvent("Chooser Read State ", ex.ToString, System.Diagnostics.EventLogEntryType.Error, EventLogErrors.ChooserFormLoad, ex.ToString)
Expand All @@ -823,6 +823,7 @@ Friend Class ChooserForm
registryAccess.WriteProfile(CONFIGRATION_SUBKEY, ALPACA_CHOOSER_WIDTH, AlpacaChooserIncrementalWidth.ToString(CultureInfo.InvariantCulture))
registryAccess.WriteProfile(CONFIGRATION_SUBKEY, ALPACA_USE_IPV4, AlpacaUseIpV4.ToString(CultureInfo.InvariantCulture))
registryAccess.WriteProfile(CONFIGRATION_SUBKEY, ALPACA_USE_IPV6, AlpacaUseIpV6.ToString(CultureInfo.InvariantCulture))
registryAccess.WriteProfile(CONFIGRATION_SUBKEY, ALPACA_MULTI_THREADED_CHOOSER, AlpacaMultiThreadedChooser.ToString(CultureInfo.InvariantCulture))

Catch ex As Exception
MsgBox("Chooser Write State " & ex.ToString)
Expand Down Expand Up @@ -907,16 +908,16 @@ Friend Class ChooserForm

TL.LogMessage("InitialiseComboBox", $"Arrived at InitialiseComboBox - Running On thread: {Thread.CurrentThread.ManagedThreadId}.")

If DEBUG_SINGLE_THREADING Then
TL.LogMessage("InitialiseComboBox", $"Starting single threaded discovery...")
DiscoverAlpacaDevicesAndPopulateDriverComboBox()
TL.LogMessage("InitialiseComboBox", $"Completed single threaded discovery")
Else ' Normal multi-threading behaviour
If AlpacaMultiThreadedChooser Then ' Multi-threading behaviour where the Chooser UI is displayed immediately while discovery runs in the background
TL.LogMessage("InitialiseComboBox", $"Creating discovery thread...")
Dim discoveryThread As Thread = New Thread(AddressOf DiscoverAlpacaDevicesAndPopulateDriverComboBox)
TL.LogMessage("InitialiseComboBox", $"Successfully created discovery thread, about to start discovery thread...")
TL.LogMessage("InitialiseComboBox", $"Successfully created discovery thread, about to start discovery on thread {discoveryThread.ManagedThreadId}...")
discoveryThread.Start()
TL.LogMessage("InitialiseComboBox", $"Discovery thread started OK")
Else ' Single threaded behaviour where the Chooser UI is not displayed until discovery completes
TL.LogMessage("InitialiseComboBox", $"Starting single threaded discovery...")
DiscoverAlpacaDevicesAndPopulateDriverComboBox()
TL.LogMessage("InitialiseComboBox", $"Completed single threaded discovery")
End If

TL.LogMessage("InitialiseComboBox", $"Exiting InitialiseComboBox on thread: {Thread.CurrentThread.ManagedThreadId}.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2102,7 +2102,7 @@ ASCOM Platform 6.5 SP1
ASCOM Platform 6.5 SP1 - Installation
ASCOM Initiative
All rights reserved. http://www.ascom-standards.org
{96FEBA4D-05AD-4875-98B9-FE2104A2B010}
{3B7B6B56-5028-4641-8DF4-4CFCDB362908}
ASCOM Initiative
ASCOM Initiative
https://ascomtalk.groups.io/g/Help
Expand Down

0 comments on commit 7634be0

Please sign in to comment.