Minimalize "Wine Configuration" impact on Game Manager

This commit is contained in:
Michael J. Seiferling
2019-02-22 13:27:22 -06:00
parent 94a6cfb074
commit 2682274e57
2 changed files with 16 additions and 53 deletions
+3 -23
View File
@@ -12,7 +12,6 @@ Public Class frmGameManager
Private oCurrentGame As clsGame
Private oTagsToSave As New List(Of KeyValuePair(Of String, String))
Private oProcessesToSave As New List(Of KeyValuePair(Of String, String))
Private oWineDataToSave As clsWineData
Private bDisableExternalFunctions As Boolean = False
Private bTriggerBackup As Boolean = False
Private bTriggerRestore As Boolean = False
@@ -211,7 +210,7 @@ Public Class frmGameManager
End Function
Private Sub HandleWineConfig()
If mgrCommon.IsUnix And cboOS.SelectedValue = clsGame.eOS.Windows Then
If mgrCommon.IsUnix And cboOS.SelectedValue = clsGame.eOS.Windows And Not eCurrentMode = eModes.Add Then
btnWineConfig.Visible = True
Else
btnWineConfig.Visible = False
@@ -738,19 +737,8 @@ Public Class frmGameManager
Public Sub OpenWineConfiguration()
Dim frm As New frmWineConfiguration
frm.Settings = oSettings
If eCurrentMode = eModes.Add Then
oWineDataToSave = New clsWineData
frm.NewMode = True
oWineDataToSave.MonitorID = txtID.Text
Else
oWineDataToSave = mgrWineData.DoWineDataGetbyID(txtID.Text)
If oWineDataToSave.MonitorID = String.Empty Then
oWineDataToSave.MonitorID = txtID.Text
End If
End If
frm.WineData = oWineDataToSave
frm.MonitorID = oCurrentGame.ID
frm.ShowDialog()
oWineDataToSave = frm.WineData
End Sub
Public Sub VerifyBackups(ByVal oApp As clsGame)
@@ -1349,13 +1337,6 @@ Public Class frmGameManager
End If
End Sub
Private Sub SaveWineData(ByVal sID As String)
If Not oWineDataToSave Is Nothing Then
oWineDataToSave.MonitorID = sID
mgrWineData.DoWineDataAddUpdate(oWineDataToSave)
End If
End Sub
Private Sub SaveApp()
Dim oData As KeyValuePair(Of String, String)
Dim oApp As New clsGame
@@ -1412,7 +1393,6 @@ Public Class frmGameManager
mgrMonitorList.DoListAdd(oApp)
SaveTags(oApp.ID)
SaveProcesses(oApp.ID)
If mgrCommon.IsUnix And oApp.OS = clsGame.eOS.Windows Then SaveWineData(oApp.ID)
eCurrentMode = eModes.View
End If
Case eModes.Edit
@@ -2050,7 +2030,7 @@ Public Class frmGameManager
End Sub
Private Sub cboOS_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboOS.SelectedIndexChanged
If Not bIsLoading Then
If Not bIsLoading And Not eCurrentMode = eModes.Add Then
HandleWineConfig()
End If
End Sub
+13 -30
View File
@@ -2,8 +2,7 @@
Public Class frmWineConfiguration
Private oSettings As mgrSettings
Private oWineData As clsWineData
Private bNewMode As Boolean = False
Private sMonitorID As String
Property Settings As mgrSettings
Get
@@ -14,21 +13,12 @@ Public Class frmWineConfiguration
End Set
End Property
Property WineData As clsWineData
Property MonitorID As String
Get
Return oWineData
Return sMonitorID
End Get
Set(value As clsWineData)
oWineData = value
End Set
End Property
Public Property NewMode As Boolean
Get
Return bNewMode
End Get
Set(value As Boolean)
bNewMode = value
Set(value As String)
sMonitorID = value
End Set
End Property
@@ -46,6 +36,8 @@ Public Class frmWineConfiguration
End Sub
Private Sub LoadData()
Dim oWineData As New clsWineData
oWineData = mgrWineData.DoWineDataGetbyID(sMonitorID)
txtWineBinaryPath.Text = oWineData.BinaryPath
txtWinePrefix.Text = oWineData.Prefix
txtWineSavePath.Text = oWineData.SavePath
@@ -74,21 +66,18 @@ Public Class frmWineConfiguration
End Function
Private Sub SaveData()
Dim oWineData As clsWineData
If txtWineBinaryPath.Text = String.Empty And txtWinePrefix.Text = String.Empty And txtWineSavePath.Text = String.Empty Then
If bNewMode Then
Me.DialogResult = DialogResult.OK
Else
mgrWineData.DoWineDataDelete(oWineData.MonitorID)
Me.DialogResult = DialogResult.OK
End If
mgrWineData.DoWineDataDelete(sMonitorID)
Me.DialogResult = DialogResult.OK
Else
If ValidateData() Then
oWineData = New clsWineData
oWineData.MonitorID = sMonitorID
oWineData.BinaryPath = txtWineBinaryPath.Text
oWineData.Prefix = txtWinePrefix.Text
oWineData.SavePath = txtWineSavePath.Text
If Not bNewMode Then
mgrWineData.DoWineDataAddUpdate(oWineData)
End If
mgrWineData.DoWineDataAddUpdate(oWineData)
Me.DialogResult = DialogResult.OK
End If
End If
@@ -108,10 +97,4 @@ Public Class frmWineConfiguration
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
Me.DialogResult = DialogResult.Cancel
End Sub
Private Sub frmWineConfiguration_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
If oWineData.BinaryPath = String.Empty And oWineData.Prefix = String.Empty And oWineData.SavePath = String.Empty Then
oWineData = Nothing
End If
End Sub
End Class