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 oCurrentGame As clsGame
Private oTagsToSave As New List(Of KeyValuePair(Of String, String)) Private oTagsToSave As New List(Of KeyValuePair(Of String, String))
Private oProcessesToSave 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 bDisableExternalFunctions As Boolean = False
Private bTriggerBackup As Boolean = False Private bTriggerBackup As Boolean = False
Private bTriggerRestore As Boolean = False Private bTriggerRestore As Boolean = False
@@ -211,7 +210,7 @@ Public Class frmGameManager
End Function End Function
Private Sub HandleWineConfig() 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 btnWineConfig.Visible = True
Else Else
btnWineConfig.Visible = False btnWineConfig.Visible = False
@@ -738,19 +737,8 @@ Public Class frmGameManager
Public Sub OpenWineConfiguration() Public Sub OpenWineConfiguration()
Dim frm As New frmWineConfiguration Dim frm As New frmWineConfiguration
frm.Settings = oSettings frm.Settings = oSettings
If eCurrentMode = eModes.Add Then frm.MonitorID = oCurrentGame.ID
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.ShowDialog() frm.ShowDialog()
oWineDataToSave = frm.WineData
End Sub End Sub
Public Sub VerifyBackups(ByVal oApp As clsGame) Public Sub VerifyBackups(ByVal oApp As clsGame)
@@ -1349,13 +1337,6 @@ Public Class frmGameManager
End If End If
End Sub 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() Private Sub SaveApp()
Dim oData As KeyValuePair(Of String, String) Dim oData As KeyValuePair(Of String, String)
Dim oApp As New clsGame Dim oApp As New clsGame
@@ -1412,7 +1393,6 @@ Public Class frmGameManager
mgrMonitorList.DoListAdd(oApp) mgrMonitorList.DoListAdd(oApp)
SaveTags(oApp.ID) SaveTags(oApp.ID)
SaveProcesses(oApp.ID) SaveProcesses(oApp.ID)
If mgrCommon.IsUnix And oApp.OS = clsGame.eOS.Windows Then SaveWineData(oApp.ID)
eCurrentMode = eModes.View eCurrentMode = eModes.View
End If End If
Case eModes.Edit Case eModes.Edit
@@ -2050,7 +2030,7 @@ Public Class frmGameManager
End Sub End Sub
Private Sub cboOS_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboOS.SelectedIndexChanged 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() HandleWineConfig()
End If End If
End Sub End Sub
+11 -28
View File
@@ -2,8 +2,7 @@
Public Class frmWineConfiguration Public Class frmWineConfiguration
Private oSettings As mgrSettings Private oSettings As mgrSettings
Private oWineData As clsWineData Private sMonitorID As String
Private bNewMode As Boolean = False
Property Settings As mgrSettings Property Settings As mgrSettings
Get Get
@@ -14,21 +13,12 @@ Public Class frmWineConfiguration
End Set End Set
End Property End Property
Property WineData As clsWineData Property MonitorID As String
Get Get
Return oWineData Return sMonitorID
End Get End Get
Set(value As clsWineData) Set(value As String)
oWineData = value sMonitorID = value
End Set
End Property
Public Property NewMode As Boolean
Get
Return bNewMode
End Get
Set(value As Boolean)
bNewMode = value
End Set End Set
End Property End Property
@@ -46,6 +36,8 @@ Public Class frmWineConfiguration
End Sub End Sub
Private Sub LoadData() Private Sub LoadData()
Dim oWineData As New clsWineData
oWineData = mgrWineData.DoWineDataGetbyID(sMonitorID)
txtWineBinaryPath.Text = oWineData.BinaryPath txtWineBinaryPath.Text = oWineData.BinaryPath
txtWinePrefix.Text = oWineData.Prefix txtWinePrefix.Text = oWineData.Prefix
txtWineSavePath.Text = oWineData.SavePath txtWineSavePath.Text = oWineData.SavePath
@@ -74,21 +66,18 @@ Public Class frmWineConfiguration
End Function End Function
Private Sub SaveData() Private Sub SaveData()
Dim oWineData As clsWineData
If txtWineBinaryPath.Text = String.Empty And txtWinePrefix.Text = String.Empty And txtWineSavePath.Text = String.Empty Then If txtWineBinaryPath.Text = String.Empty And txtWinePrefix.Text = String.Empty And txtWineSavePath.Text = String.Empty Then
If bNewMode Then mgrWineData.DoWineDataDelete(sMonitorID)
Me.DialogResult = DialogResult.OK Me.DialogResult = DialogResult.OK
Else
mgrWineData.DoWineDataDelete(oWineData.MonitorID)
Me.DialogResult = DialogResult.OK
End If
Else Else
If ValidateData() Then If ValidateData() Then
oWineData = New clsWineData
oWineData.MonitorID = sMonitorID
oWineData.BinaryPath = txtWineBinaryPath.Text oWineData.BinaryPath = txtWineBinaryPath.Text
oWineData.Prefix = txtWinePrefix.Text oWineData.Prefix = txtWinePrefix.Text
oWineData.SavePath = txtWineSavePath.Text oWineData.SavePath = txtWineSavePath.Text
If Not bNewMode Then
mgrWineData.DoWineDataAddUpdate(oWineData) mgrWineData.DoWineDataAddUpdate(oWineData)
End If
Me.DialogResult = DialogResult.OK Me.DialogResult = DialogResult.OK
End If End If
End If End If
@@ -108,10 +97,4 @@ Public Class frmWineConfiguration
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
Me.DialogResult = DialogResult.Cancel Me.DialogResult = DialogResult.Cancel
End Sub 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 End Class