From c557b2554b3974eb90a0a95988dc7d1a78556b44 Mon Sep 17 00:00:00 2001 From: Dunestorm Date: Thu, 14 Mar 2019 18:57:13 +0000 Subject: [PATCH] Implemented basic theme engine as well as a dark theme. For time being, dark theme is the default theme. --- GBM/Forms/frmMain.Designer.vb | 33 ++++++++++++------------- GBM/Forms/frmMain.vb | 19 +++++++++++++++ GBM/Game Backup Monitor.vbproj | 1 + GBM/Managers/mgrThemeEngine.vb | 26 ++++++++++++++++++++ GBM/My Project/Resources.Designer.vb | 36 ++++++++++++++++++++++++++++ GBM/My Project/Resources.resx | 12 ++++++++++ 6 files changed, 111 insertions(+), 16 deletions(-) create mode 100644 GBM/Managers/mgrThemeEngine.vb diff --git a/GBM/Forms/frmMain.Designer.vb b/GBM/Forms/frmMain.Designer.vb index 8e2d291..d21040a 100644 --- a/GBM/Forms/frmMain.Designer.vb +++ b/GBM/Forms/frmMain.Designer.vb @@ -34,9 +34,9 @@ Partial Class frmMain Me.gMonTraySetup = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTraySetupAddWizard = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTraySetupGameManager = New System.Windows.Forms.ToolStripMenuItem() - Me.gMonTraySetupCustomVariables = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTraySetupTags = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTraySetupProcessManager = New System.Windows.Forms.ToolStripMenuItem() + Me.gMonTraySetupCustomVariables = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayTools = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayToolsCompact = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTrayToolsLog = New System.Windows.Forms.ToolStripMenuItem() @@ -64,9 +64,9 @@ Partial Class frmMain Me.gMonSetup = New System.Windows.Forms.ToolStripMenuItem() Me.gMonSetupGameManager = New System.Windows.Forms.ToolStripMenuItem() Me.gMonSetupAddWizard = New System.Windows.Forms.ToolStripMenuItem() - Me.gMonSetupCustomVariables = New System.Windows.Forms.ToolStripMenuItem() Me.gMonSetupTags = New System.Windows.Forms.ToolStripMenuItem() Me.gMonSetupProcessManager = New System.Windows.Forms.ToolStripMenuItem() + Me.gMonSetupCustomVariables = New System.Windows.Forms.ToolStripMenuItem() Me.gMonTools = New System.Windows.Forms.ToolStripMenuItem() Me.gMonToolsCompact = New System.Windows.Forms.ToolStripMenuItem() Me.gMonToolsLog = New System.Windows.Forms.ToolStripMenuItem() @@ -162,12 +162,6 @@ Partial Class frmMain Me.gMonTraySetupGameManager.Size = New System.Drawing.Size(201, 22) Me.gMonTraySetupGameManager.Text = "&Game Manager..." ' - 'gMonTraySetupCustomVariables - ' - Me.gMonTraySetupCustomVariables.Name = "gMonTraySetupCustomVariables" - Me.gMonTraySetupCustomVariables.Size = New System.Drawing.Size(201, 22) - Me.gMonTraySetupCustomVariables.Text = "Custom Path &Variables..." - ' 'gMonTraySetupTags ' Me.gMonTraySetupTags.Name = "gMonTraySetupTags" @@ -180,6 +174,12 @@ Partial Class frmMain Me.gMonTraySetupProcessManager.Size = New System.Drawing.Size(201, 22) Me.gMonTraySetupProcessManager.Text = "&Process Manager..." ' + 'gMonTraySetupCustomVariables + ' + Me.gMonTraySetupCustomVariables.Name = "gMonTraySetupCustomVariables" + Me.gMonTraySetupCustomVariables.Size = New System.Drawing.Size(201, 22) + Me.gMonTraySetupCustomVariables.Text = "Custom Path &Variables..." + ' 'gMonTrayTools ' Me.gMonTrayTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonTrayToolsCompact, Me.gMonTrayToolsLog, Me.gMonTrayToolsSessions, Me.gMonTrayToolsSyncGameID}) @@ -270,6 +270,7 @@ Partial Class frmMain ' 'gMonStatusStrip ' + Me.gMonStatusStrip.BackColor = System.Drawing.Color.Transparent Me.gMonStatusStrip.Font = New System.Drawing.Font("Segoe UI", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.gMonStatusStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonStripAdminButton, Me.gMonStripTxtStatus, Me.gMonStripStatusButton}) Me.gMonStatusStrip.Location = New System.Drawing.Point(0, 379) @@ -291,7 +292,7 @@ Partial Class frmMain ' Me.gMonStripTxtStatus.Margin = New System.Windows.Forms.Padding(5, 0, 0, 0) Me.gMonStripTxtStatus.Name = "gMonStripTxtStatus" - Me.gMonStripTxtStatus.Size = New System.Drawing.Size(400, 22) + Me.gMonStripTxtStatus.Size = New System.Drawing.Size(369, 22) Me.gMonStripTxtStatus.Spring = True Me.gMonStripTxtStatus.Text = "Monitor Status" Me.gMonStripTxtStatus.TextAlign = System.Drawing.ContentAlignment.MiddleLeft @@ -308,7 +309,7 @@ Partial Class frmMain Me.gMonMainMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonFile, Me.gMonSetup, Me.gMonTools, Me.gMonHelp, Me.gMonNotification}) Me.gMonMainMenu.Location = New System.Drawing.Point(0, 0) Me.gMonMainMenu.Name = "gMonMainMenu" - Me.gMonMainMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System + Me.gMonMainMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional Me.gMonMainMenu.Size = New System.Drawing.Size(524, 24) Me.gMonMainMenu.TabIndex = 0 Me.gMonMainMenu.Text = "MenuStrip1" @@ -367,12 +368,6 @@ Partial Class frmMain Me.gMonSetupAddWizard.Size = New System.Drawing.Size(201, 22) Me.gMonSetupAddWizard.Text = "Add Game &Wizard..." ' - 'gMonSetupCustomVariables - ' - Me.gMonSetupCustomVariables.Name = "gMonSetupCustomVariables" - Me.gMonSetupCustomVariables.Size = New System.Drawing.Size(201, 22) - Me.gMonSetupCustomVariables.Text = "Custom Path &Variables..." - ' 'gMonSetupTags ' Me.gMonSetupTags.Name = "gMonSetupTags" @@ -385,6 +380,12 @@ Partial Class frmMain Me.gMonSetupProcessManager.Size = New System.Drawing.Size(201, 22) Me.gMonSetupProcessManager.Text = "&Process Manager..." ' + 'gMonSetupCustomVariables + ' + Me.gMonSetupCustomVariables.Name = "gMonSetupCustomVariables" + Me.gMonSetupCustomVariables.Size = New System.Drawing.Size(201, 22) + Me.gMonSetupCustomVariables.Text = "Custom Path &Variables..." + ' 'gMonTools ' Me.gMonTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.gMonToolsCompact, Me.gMonToolsLog, Me.gMonToolsSessions, Me.gMonToolsSyncGameID}) diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 8b7b4d6..4b60ad1 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -1564,6 +1564,25 @@ Public Class frmMain pbTime.Image = Icon_Clock AddHandler mgrMonitorList.UpdateLog, AddressOf UpdateLog ResetGameInfo() + + 'Initialise theme engine + Dim oThemeEngine As New mgrThemeEngine + oThemeEngine.SetTheme(mgrThemeEngine.eTheme.Dark) + BackColor = oThemeEngine.colBase + gMonMainMenu.BackColor = oThemeEngine.colBase + gMonMainMenu.ForeColor = oThemeEngine.colHighlightAlt + gMonStatusStrip.BackColor = oThemeEngine.colBase + gMonStripTxtStatus.ForeColor = oThemeEngine.colHightlight + gMonStripStatusButton.ForeColor = oThemeEngine.colHightlight + lblGameTitle.ForeColor = oThemeEngine.colHightlight + lblStatus1.ForeColor = oThemeEngine.colHightlight + lblStatus2.ForeColor = oThemeEngine.colHightlight + lblStatus3.ForeColor = oThemeEngine.colHightlight + lblTimeSpent.ForeColor = oThemeEngine.colHightlight + lblLastActionTitle.ForeColor = oThemeEngine.colHightlight + lblLastAction.ForeColor = oThemeEngine.colHightlight + txtLog.BackColor = oThemeEngine.colBaseAlt + txtLog.ForeColor = oThemeEngine.colHightlight End Sub Private Function BuildChildProcesses() As Integer diff --git a/GBM/Game Backup Monitor.vbproj b/GBM/Game Backup Monitor.vbproj index 062ec7e..13fc0b0 100644 --- a/GBM/Game Backup Monitor.vbproj +++ b/GBM/Game Backup Monitor.vbproj @@ -123,6 +123,7 @@ + diff --git a/GBM/Managers/mgrThemeEngine.vb b/GBM/Managers/mgrThemeEngine.vb new file mode 100644 index 0000000..10ed2b6 --- /dev/null +++ b/GBM/Managers/mgrThemeEngine.vb @@ -0,0 +1,26 @@ +Imports GBM.My.Resources + +Public Class mgrThemeEngine + + Public ReadOnly Property colBase As Color + Public ReadOnly Property colBaseAlt As Color + Public ReadOnly Property colHightlight As Color + Public ReadOnly Property colHighlightAlt As Color + + + Public Enum eTheme + Dark + End Enum + + Public Function SetTheme(thm As eTheme) + Dim selectedColor As Color + Select Case thm + Case eTheme.Dark + _colBase = New ColorConverter().ConvertFromString(mgrThemeEngine_Color_Dark) + _colBaseAlt = New ColorConverter().ConvertFromString(mgrThemeEngine_Color_Black) + _colHightlight = New ColorConverter().ConvertFromString(mgrThemeEngine_Color_White) + _colHighlightAlt = New ColorConverter().ConvertFromString(mgrThemeEngine_Color_Blue) + End Select + Return selectedColor + End Function +End Class diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 1821ce0..08bd9d1 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -6825,6 +6825,42 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to 0,0,0. + ''' + Friend ReadOnly Property mgrThemeEngine_Color_Black() As String + Get + Return ResourceManager.GetString("mgrThemeEngine_Color_Black", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to 0,131,255. + ''' + Friend ReadOnly Property mgrThemeEngine_Color_Blue() As String + Get + Return ResourceManager.GetString("mgrThemeEngine_Color_Blue", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to 25,25,25. + ''' + Friend ReadOnly Property mgrThemeEngine_Color_Dark() As String + Get + Return ResourceManager.GetString("mgrThemeEngine_Color_Dark", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to 255,255,255. + ''' + Friend ReadOnly Property mgrThemeEngine_Color_White() As String + Get + Return ResourceManager.GetString("mgrThemeEngine_Color_White", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to An error occured exporting the XML data.[BR][BR][PARAM]. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 93ecc85..af341f0 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2374,4 +2374,16 @@ Current Folder + + 0,0,0 + + + 0,131,255 + + + 25,25,25 + + + 255,255,255 + \ No newline at end of file