Skip to content

Commit

Permalink
Made it so when multiple FX3s are available, form remembers the last …
Browse files Browse the repository at this point in the history
…FX3 connected and selects that board by default from the drop down menu
  • Loading branch information
ajn96 committed Jul 31, 2020
1 parent 683711b commit 2930276
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
<setting name="BackColor" serializeAs="String">
<value>Control</value>
</setting>
<setting name="LastFX3Board" serializeAs="String">
<value />
</setting>
</iSensorFX3Eval.My.MySettings>
</userSettings>
</configuration>
12 changes: 12 additions & 0 deletions src/My Project/Settings.Designer.vb

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

3 changes: 3 additions & 0 deletions src/My Project/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
<Setting Name="BackColor" Type="System.Drawing.Color" Scope="User">
<Value Profile="(Default)">Control</Value>
</Setting>
<Setting Name="LastFX3Board" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
5 changes: 5 additions & 0 deletions src/SelectFX3GUI.vb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ Public Class SelectFX3GUI

'Set combo box to read-only
SelectFX3ComboBox.DropDownStyle = ComboBoxStyle.DropDownList

'if last connected fx3 is available select it by default
If m_TopGUI.FX3.AvailableFX3s.Contains(m_TopGUI.LastFX3SN) Then
SelectFX3ComboBox.SelectedItem = m_TopGUI.LastFX3SN
End If
End Sub

Private Sub SelectFX3ComboBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles SelectFX3ComboBox.SelectedIndexChanged
Expand Down
11 changes: 11 additions & 0 deletions src/TopGUI.vb
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ Public Class TopGUI
My.Settings.ErrorColor = ERROR_COLOR
My.Settings.IdleColor = IDLE_COLOR
My.Settings.BackColor = BACK_COLOR
My.Settings.LastFX3Board = FX3.ActiveFX3SerialNumber
My.Settings.Save()
End Sub

Expand Down Expand Up @@ -531,6 +532,16 @@ Public Class TopGUI

#Region "Helper Functions"

''' <summary>
''' Friend getter for last connected FX3 board SN
''' </summary>
''' <returns></returns>
Friend ReadOnly Property LastFX3SN As String
Get
Return My.Settings.LastFX3Board
End Get
End Property

''' <summary>
''' Loads default color scheme
''' </summary>
Expand Down

0 comments on commit 2930276

Please sign in to comment.