diff --git a/mRemoteV1/Config/Theme.vb b/mRemoteV1/Config/Theme.vb index c9dcb3df9..45603eaa1 100644 --- a/mRemoteV1/Config/Theme.vb +++ b/mRemoteV1/Config/Theme.vb @@ -26,14 +26,14 @@ Namespace Config Public Sub EndUpdate() _inUpdate = False - RaiseColorChanged() + RaiseThemeChanged() End Sub #End Region #Region "Events" - Public Event ColorChanged() - Protected Sub RaiseColorChanged() - If Not _inUpdate Then RaiseEvent ColorChanged() + Public Event ThemeChanged() + Protected Sub RaiseThemeChanged() + If Not _inUpdate Then RaiseEvent ThemeChanged() End Sub #End Region @@ -48,7 +48,6 @@ Namespace Config #Region "General" Private _windowBackground As Color = SystemColors.AppWorkspace _ Public Property WindowBackground() As Color @@ -58,13 +57,13 @@ Namespace Config Set(value As Color) If _windowBackground = value Then Return _windowBackground = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property Private _menuBackground As Color = SystemColors.Control Public Property MenuBackground() As Color @@ -74,13 +73,13 @@ Namespace Config Set(value As Color) If _menuBackground = value Then Return _menuBackground = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property Private _menuText As Color = SystemColors.ControlText Public Property MenuText() As Color @@ -90,13 +89,13 @@ Namespace Config Set(value As Color) If _menuText = value Then Return _menuText = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property Private _toolbarBackground As Color = SystemColors.Control _ Public Property ToolbarBackground() As Color @@ -106,13 +105,13 @@ Namespace Config Set(value As Color) If _toolbarBackground = value Then Return _toolbarBackground = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property Private _toolbarText As Color = SystemColors.ControlText _ Public Property ToolbarText() As Color @@ -122,7 +121,7 @@ Namespace Config Set(value As Color) If _toolbarText = value Then Return _toolbarText = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property #End Region @@ -130,7 +129,6 @@ Namespace Config #Region "Connections Panel" Private _connectionsPanelBackground As Color = SystemColors.Window _ Public Property ConnectionsPanelBackground() As Color @@ -138,15 +136,14 @@ Namespace Config Return _connectionsPanelBackground End Get Set(value As Color) - If _connectionsPanelBackground = value Then Return + If _connectionsPanelBackground = value Or value = Color.Transparent Then Return _connectionsPanelBackground = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property Private _connectionsPanelText As Color = SystemColors.WindowText Public Property ConnectionsPanelText() As Color @@ -156,13 +153,12 @@ Namespace Config Set(value As Color) If _connectionsPanelText = value Then Return _connectionsPanelText = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property Private _connectionsPanelTreeLines As Color = Color.Black Public Property ConnectionsPanelTreeLines() As Color @@ -172,13 +168,12 @@ Namespace Config Set(value As Color) If _connectionsPanelTreeLines = value Then Return _connectionsPanelTreeLines = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property Private _searchBoxBackground As Color = SystemColors.Window _ Public Property SearchBoxBackground() As Color @@ -186,41 +181,39 @@ Namespace Config Return _searchBoxBackground End Get Set(value As Color) - If _searchBoxBackground = value Then Return + If _searchBoxBackground = value Or value = Color.Transparent Then Return _searchBoxBackground = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property - Private _searchBoxTextUnfocused As Color = SystemColors.GrayText + Private _searchBoxTextPrompt As Color = SystemColors.GrayText _ - Public Property SearchBoxTextUnfocused() As Color + Public Property SearchBoxTextPrompt() As Color Get - Return _searchBoxTextUnfocused + Return _searchBoxTextPrompt End Get Set(value As Color) - If _searchBoxTextUnfocused = value Then Return - _searchBoxTextUnfocused = value - RaiseColorChanged() + If _searchBoxTextPrompt = value Then Return + _searchBoxTextPrompt = value + RaiseThemeChanged() End Set End Property - Private _searchBoxTextFocused As Color = SystemColors.WindowText + Private _searchBoxText As Color = SystemColors.WindowText _ - Public Property SearchBoxTextFocused() As Color + Public Property SearchBoxText() As Color Get - Return _searchBoxTextFocused + Return _searchBoxText End Get Set(value As Color) - If _searchBoxTextFocused = value Then Return - _searchBoxTextFocused = value - RaiseColorChanged() + If _searchBoxText = value Then Return + _searchBoxText = value + RaiseThemeChanged() End Set End Property #End Region @@ -228,7 +221,6 @@ Namespace Config #Region "Config Panel" Private _configPanelBackground As Color = SystemColors.Window _ Public Property ConfigPanelBackground() As Color @@ -236,15 +228,14 @@ Namespace Config Return _configPanelBackground End Get Set(value As Color) - If _configPanelBackground = value Then Return + If _configPanelBackground = value Or value = Color.Transparent Then Return _configPanelBackground = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property Private _configPanelText As Color = SystemColors.WindowText _ Public Property ConfigPanelText() As Color @@ -254,13 +245,12 @@ Namespace Config Set(value As Color) If _configPanelText = value Then Return _configPanelText = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property Private _configPanelCategoryText As Color = SystemColors.ControlText _ Public Property ConfigPanelCategoryText() As Color @@ -270,13 +260,12 @@ Namespace Config Set(value As Color) If _configPanelCategoryText = value Then Return _configPanelCategoryText = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property Private _configPanelHelpBackground As Color = SystemColors.Control _ Public Property ConfigPanelHelpBackground() As Color @@ -284,15 +273,14 @@ Namespace Config Return _configPanelHelpBackground End Get Set(value As Color) - If _configPanelHelpBackground = value Then Return + If _configPanelHelpBackground = value Or value = Color.Transparent Then Return _configPanelHelpBackground = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property Private _configPanelHelpText As Color = SystemColors.ControlText _ Public Property ConfigPanelHelpText() As Color @@ -302,13 +290,12 @@ Namespace Config Set(value As Color) If _configPanelHelpText = value Then Return _configPanelHelpText = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property Private _configPanelGridLines As Color = SystemColors.InactiveBorder _ Public Property ConfigPanelGridLines() As Color @@ -318,7 +305,7 @@ Namespace Config Set(value As Color) If _configPanelGridLines = value Then Return _configPanelGridLines = value - RaiseColorChanged() + RaiseThemeChanged() End Set End Property #End Region diff --git a/mRemoteV1/Config/ThemeSerializer.vb b/mRemoteV1/Config/ThemeSerializer.vb index cf3cb1eea..b4c067f1c 100644 --- a/mRemoteV1/Config/ThemeSerializer.vb +++ b/mRemoteV1/Config/ThemeSerializer.vb @@ -90,7 +90,7 @@ Namespace Config colorName = colorNode.Attributes("Name").Value colorValue = colorNode.Attributes("Value").Value propertyInfo = themeType.GetProperty(colorName) - If Not propertyInfo.PropertyType Is colorType Then Continue For + If propertyInfo Is Nothing OrElse Not propertyInfo.PropertyType Is colorType Then Continue For propertyInfo.SetValue(theme, Color.FromName(colorValue), Nothing) Next themes.Add(theme) diff --git a/mRemoteV1/Forms/frmMain.vb b/mRemoteV1/Forms/frmMain.vb index bb466dbce..7a05925f5 100644 --- a/mRemoteV1/Forms/frmMain.vb +++ b/mRemoteV1/Forms/frmMain.vb @@ -49,7 +49,7 @@ Public Class frmMain ApplyLanguage() Try - AddHandler Windows.Theme.ColorChanged, AddressOf ApplyColors + AddHandler Windows.Theme.ThemeChanged, AddressOf ApplyThemes Dim themes As List(Of Theme) = ThemeSerializer.LoadFromXmlFile(Path.Combine(App.Info.Settings.SettingsPath, "Theme.xml")) If themes.Count Then Windows.Theme.FromTheme(themes(0)) Catch ex As Exception @@ -176,7 +176,7 @@ Public Class frmMain ToolStripMenuItem2.Text = My.Language.strKeysCtrlEsc End Sub - Public Sub ApplyColors() + Public Sub ApplyThemes() With Windows.Theme pnlDock.DockBackColor = .WindowBackground tsContainer.BackColor = .ToolbarBackground diff --git a/mRemoteV1/UI/UI.Window.Config.vb b/mRemoteV1/UI/UI.Window.Config.vb index f7be128a9..d7351304c 100644 --- a/mRemoteV1/UI/UI.Window.Config.vb +++ b/mRemoteV1/UI/UI.Window.Config.vb @@ -488,7 +488,7 @@ Namespace UI TabText = My.Language.strMenuConfig End Sub - Private Sub ApplyColors() + Private Sub ApplyTheme() With Windows.Theme pGrid.BackColor = .ToolbarBackground pGrid.ForeColor = .ToolbarText @@ -554,8 +554,8 @@ Namespace UI Private Sub Config_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ApplyLanguage() - AddHandler Windows.Theme.ColorChanged, AddressOf ApplyColors - ApplyColors() + AddHandler Windows.Theme.ThemeChanged, AddressOf ApplyTheme + ApplyTheme() AddToolStripItems() End Sub diff --git a/mRemoteV1/UI/UI.Window.Tree.vb b/mRemoteV1/UI/UI.Window.Tree.vb index eb7dd33c4..24e305e96 100644 --- a/mRemoteV1/UI/UI.Window.Tree.vb +++ b/mRemoteV1/UI/UI.Window.Tree.vb @@ -466,8 +466,8 @@ Namespace UI Private Sub Tree_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ApplyLanguage() - AddHandler Windows.Theme.ColorChanged, AddressOf ApplyColors - ApplyColors() + AddHandler Windows.Theme.ThemeChanged, AddressOf ApplyTheme + ApplyTheme() txtSearch.Multiline = True txtSearch.MinimumSize = New Size(0, 14) @@ -511,7 +511,7 @@ Namespace UI Text = My.Language.strConnections End Sub - Public Sub ApplyColors() + Public Sub ApplyTheme() With Windows.Theme msMain.BackColor = .ToolbarBackground msMain.ForeColor = .ToolbarText @@ -520,7 +520,7 @@ Namespace UI tvConnections.LineColor = .ConnectionsPanelTreeLines BackColor = .ToolbarBackground txtSearch.BackColor = .SearchBoxBackground - txtSearch.ForeColor = .SearchBoxTextUnfocused + txtSearch.ForeColor = .SearchBoxTextPrompt End With End Sub #End Region @@ -1227,7 +1227,7 @@ Namespace UI #Region "Search" Private Sub txtSearch_GotFocus(ByVal sender As Object, ByVal e As EventArgs) Handles txtSearch.GotFocus - txtSearch.ForeColor = Windows.Theme.SearchBoxTextFocused + txtSearch.ForeColor = Windows.Theme.SearchBoxText If txtSearch.Text = Language.strSearchPrompt Then txtSearch.Text = "" End If @@ -1235,7 +1235,7 @@ Namespace UI Private Sub txtSearch_LostFocus(ByVal sender As Object, ByVal e As EventArgs) Handles txtSearch.LostFocus If txtSearch.Text = "" Then - txtSearch.ForeColor = Windows.Theme.SearchBoxTextUnfocused + txtSearch.ForeColor = Windows.Theme.SearchBoxTextPrompt txtSearch.Text = Language.strSearchPrompt End If End Sub