From 2682274e574bbe81f230fd0d13a3aec261d3e755 Mon Sep 17 00:00:00 2001 From: "Michael J. Seiferling" Date: Fri, 22 Feb 2019 13:27:22 -0600 Subject: [PATCH] Minimalize "Wine Configuration" impact on Game Manager --- GBM/Forms/frmGameManager.vb | 26 +++---------------- GBM/Forms/frmWineConfiguration.vb | 43 ++++++++++--------------------- 2 files changed, 16 insertions(+), 53 deletions(-) diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 2ad44dd..4a85254 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -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 diff --git a/GBM/Forms/frmWineConfiguration.vb b/GBM/Forms/frmWineConfiguration.vb index 434410c..8838a01 100644 --- a/GBM/Forms/frmWineConfiguration.vb +++ b/GBM/Forms/frmWineConfiguration.vb @@ -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 \ No newline at end of file