Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
Changes:

* Moved "Hold to play" to settings.
* Fixed cancelation of BackgroundWorker on FormClosing event.
* Changed icon.
  • Loading branch information
SilentSys committed Mar 13, 2016
1 parent a003755 commit 1adf5f3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 26 deletions.
15 changes: 1 addition & 14 deletions SLAM/Form1.Designer.vb

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

18 changes: 9 additions & 9 deletions SLAM/Form1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ Public Class Form1

Dim Games As New List(Of SourceGame)
Dim running As Boolean = False
Dim ClosePending As Boolean = False

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

HoldToPlay.Checked = My.Settings.HoldToPlay

If My.Settings.UpdateCheck Then
CheckForUpdate()
End If
Expand Down Expand Up @@ -304,7 +303,7 @@ Public Class Form1
slam_cfg.WriteLine("alias slam_play_on ""alias slam_play slam_play_off; voice_inputfromfile 1; voice_loopback 1; +voicerecord""")
slam_cfg.WriteLine("alias slam_play_off ""-voicerecord; voice_inputfromfile 0; voice_loopback 0; alias slam_play slam_play_on""")
slam_cfg.WriteLine("alias slam_updatecfg ""host_writeconfig slam_relay""")
If HoldToPlay.Checked Then
If My.Settings.HoldToPlay Then
slam_cfg.WriteLine("alias +slam_hold_play slam_play_on")
slam_cfg.WriteLine("alias -slam_hold_play slam_play_off")
slam_cfg.WriteLine("bind {0} +slam_hold_play", My.Settings.PlayKey)
Expand Down Expand Up @@ -567,6 +566,10 @@ Public Class Form1
If Not IsNothing(e.Result) Then 'Result is always an exception
MessageBox.Show(e.Result.Message & " See errorlog.txt for more info.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If

If ClosePending Then
Me.Close()
End If
End Sub

Private Sub CreateTags(ByVal Game As SourceGame)
Expand Down Expand Up @@ -667,7 +670,7 @@ Public Class Form1

Private Sub TrackList_MouseClick(sender As Object, e As MouseEventArgs) Handles TrackList.MouseClick
If e.Button = MouseButtons.Right Then
If TrackList.FocusedItem.Bounds.Contains(e.Location) = True Then
If TrackList.FocusedItem.Bounds.Contains(e.Location) Then

For Each Control In TrackContextMenu.Items 'everything invisible
Control.visible = False
Expand Down Expand Up @@ -901,13 +904,10 @@ Public Class Form1
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
If running Then
StopPoll()
ClosePending = True
e.Cancel = True
End If
End Sub

Private Sub HoldToPlay_CheckedChanged(sender As Object, e As EventArgs) Handles HoldToPlay.CheckedChanged
My.Settings.HoldToPlay = HoldToPlay.Checked
My.Settings.Save()
End Sub
End Class


4 changes: 2 additions & 2 deletions SLAM/SLAM.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>SlamIcon.ico</ApplicationIcon>
<ApplicationIcon>SlamSliders.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>My Project\app.manifest</ApplicationManifest>
Expand Down Expand Up @@ -188,7 +188,7 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="SlamIcon.ico" />
<Content Include="SlamSliders.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
Expand Down
15 changes: 14 additions & 1 deletion SLAM/SettingsForm.Designer.vb

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

6 changes: 6 additions & 0 deletions SLAM/SettingsForm.vb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
StartEnabledCheckBox.Checked = My.Settings.StartEnabled
ConTagsCheckBox.Checked = My.Settings.WriteTags
ChangeRelayButton.Text = String.Format("Relay key: ""{0}"" (change)", My.Settings.RelayKey)
HoldToPlay.Checked = My.Settings.HoldToPlay
End Sub

Private Sub UpdateCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles UpdateCheckBox.CheckedChanged
Expand Down Expand Up @@ -43,4 +44,9 @@
ChangeRelayButton.Text = String.Format("Relay key: ""{0}"" (change)", My.Settings.RelayKey)
End If
End Sub

Private Sub HoldToPlay_CheckedChanged(sender As Object, e As EventArgs) Handles HoldToPlay.CheckedChanged
My.Settings.HoldToPlay = HoldToPlay.Checked
My.Settings.Save()
End Sub
End Class
Binary file removed SLAM/SlamIcon.ico
Binary file not shown.

0 comments on commit 1adf5f3

Please sign in to comment.