Skip to content

Commit 1adf5f3

Browse files
committed
Clean up
Changes: * Moved "Hold to play" to settings. * Fixed cancelation of BackgroundWorker on FormClosing event. * Changed icon.
1 parent a003755 commit 1adf5f3

6 files changed

Lines changed: 32 additions & 26 deletions

File tree

SLAM/Form1.Designer.vb

Lines changed: 1 addition & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SLAM/Form1.vb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ Public Class Form1
1111

1212
Dim Games As New List(Of SourceGame)
1313
Dim running As Boolean = False
14+
Dim ClosePending As Boolean = False
1415

1516
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
1617
RefreshPlayKey()
1718

18-
HoldToPlay.Checked = My.Settings.HoldToPlay
19-
2019
If My.Settings.UpdateCheck Then
2120
CheckForUpdate()
2221
End If
@@ -304,7 +303,7 @@ Public Class Form1
304303
slam_cfg.WriteLine("alias slam_play_on ""alias slam_play slam_play_off; voice_inputfromfile 1; voice_loopback 1; +voicerecord""")
305304
slam_cfg.WriteLine("alias slam_play_off ""-voicerecord; voice_inputfromfile 0; voice_loopback 0; alias slam_play slam_play_on""")
306305
slam_cfg.WriteLine("alias slam_updatecfg ""host_writeconfig slam_relay""")
307-
If HoldToPlay.Checked Then
306+
If My.Settings.HoldToPlay Then
308307
slam_cfg.WriteLine("alias +slam_hold_play slam_play_on")
309308
slam_cfg.WriteLine("alias -slam_hold_play slam_play_off")
310309
slam_cfg.WriteLine("bind {0} +slam_hold_play", My.Settings.PlayKey)
@@ -567,6 +566,10 @@ Public Class Form1
567566
If Not IsNothing(e.Result) Then 'Result is always an exception
568567
MessageBox.Show(e.Result.Message & " See errorlog.txt for more info.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
569568
End If
569+
570+
If ClosePending Then
571+
Me.Close()
572+
End If
570573
End Sub
571574

572575
Private Sub CreateTags(ByVal Game As SourceGame)
@@ -667,7 +670,7 @@ Public Class Form1
667670

668671
Private Sub TrackList_MouseClick(sender As Object, e As MouseEventArgs) Handles TrackList.MouseClick
669672
If e.Button = MouseButtons.Right Then
670-
If TrackList.FocusedItem.Bounds.Contains(e.Location) = True Then
673+
If TrackList.FocusedItem.Bounds.Contains(e.Location) Then
671674

672675
For Each Control In TrackContextMenu.Items 'everything invisible
673676
Control.visible = False
@@ -901,13 +904,10 @@ Public Class Form1
901904
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
902905
If running Then
903906
StopPoll()
907+
ClosePending = True
908+
e.Cancel = True
904909
End If
905910
End Sub
906-
907-
Private Sub HoldToPlay_CheckedChanged(sender As Object, e As EventArgs) Handles HoldToPlay.CheckedChanged
908-
My.Settings.HoldToPlay = HoldToPlay.Checked
909-
My.Settings.Save()
910-
End Sub
911911
End Class
912912

913913

SLAM/SLAM.vbproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<OptionInfer>On</OptionInfer>
6363
</PropertyGroup>
6464
<PropertyGroup>
65-
<ApplicationIcon>SlamIcon.ico</ApplicationIcon>
65+
<ApplicationIcon>SlamSliders.ico</ApplicationIcon>
6666
</PropertyGroup>
6767
<PropertyGroup>
6868
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
@@ -188,7 +188,7 @@
188188
<None Include="App.config" />
189189
</ItemGroup>
190190
<ItemGroup>
191-
<Content Include="SlamIcon.ico" />
191+
<Content Include="SlamSliders.ico" />
192192
</ItemGroup>
193193
<ItemGroup>
194194
<BootstrapperPackage Include=".NETFramework,Version=v4.5">

SLAM/SettingsForm.Designer.vb

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SLAM/SettingsForm.vb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
StartEnabledCheckBox.Checked = My.Settings.StartEnabled
99
ConTagsCheckBox.Checked = My.Settings.WriteTags
1010
ChangeRelayButton.Text = String.Format("Relay key: ""{0}"" (change)", My.Settings.RelayKey)
11+
HoldToPlay.Checked = My.Settings.HoldToPlay
1112
End Sub
1213

1314
Private Sub UpdateCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles UpdateCheckBox.CheckedChanged
@@ -43,4 +44,9 @@
4344
ChangeRelayButton.Text = String.Format("Relay key: ""{0}"" (change)", My.Settings.RelayKey)
4445
End If
4546
End Sub
47+
48+
Private Sub HoldToPlay_CheckedChanged(sender As Object, e As EventArgs) Handles HoldToPlay.CheckedChanged
49+
My.Settings.HoldToPlay = HoldToPlay.Checked
50+
My.Settings.Save()
51+
End Sub
4652
End Class

SLAM/SlamIcon.ico

-361 KB
Binary file not shown.

0 commit comments

Comments
 (0)