More theme improvements.

This commit is contained in:
Riley McArdle
2013-03-14 20:18:56 -05:00
parent 9f09798da5
commit 437ff003b0
8 changed files with 56 additions and 8 deletions

View File

@@ -44,6 +44,8 @@ Namespace Config
log.InfoFormat("Override Culture: {0}/{1}", Threading.Thread.CurrentThread.CurrentUICulture.Name, Threading.Thread.CurrentThread.CurrentUICulture.NativeName)
End If
Themes.ThemeManager.LoadTheme(My.Settings.ThemeName)
.WindowState = FormWindowState.Normal
If My.Settings.MainFormState = FormWindowState.Normal Then
If Not My.Settings.MainFormLocation.IsEmpty Then .Location = My.Settings.MainFormLocation

View File

@@ -37,14 +37,6 @@ Public Class frmMain
Startup.CreateLogger()
Try
ThemeManager.LoadThemes()
ThemeManager.ActiveTheme = ThemeManager.DefaultTheme
AddHandler ThemeManager.ThemeChanged, AddressOf ApplyThemes
Catch ex As Exception
Debug.Print(ex.Message)
End Try
' Create gui config load and save objects
Dim SettingsLoad As New Config.Settings.Load(Me)
@@ -56,6 +48,8 @@ Public Class frmMain
Startup.ParseCommandLineArgs()
ApplyLanguage()
AddHandler ThemeManager.ThemeChanged, AddressOf ApplyThemes
ApplyThemes()
fpChainedWindowHandle = SetClipboardViewer(Me.Handle)

View File

@@ -1802,6 +1802,7 @@ Public Class frmOptions
My.Settings.XULRunnerPath = Me.txtXULrunnerPath.Text
ThemeManager.SaveThemes(_themeList)
Settings.ThemeName = ThemeManager.ActiveTheme.Name
If My.Settings.LoadConsFromCustomLocation = False Then
App.Runtime.SetMainFormText(App.Info.Connections.DefaultConnectionsPath & "\" & App.Info.Connections.DefaultConnectionsFile)

View File

@@ -2332,6 +2332,19 @@ Namespace My
Return CType(Me("UpdateChannel"),String)
End Get
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Configuration.SettingsProviderAttribute(GetType(mRemoteNG.Config.Settings.Providers.ChooseProvider)), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public Property ThemeName() As String
Get
Return CType(Me("ThemeName"),String)
End Get
Set
Me("ThemeName") = value
End Set
End Property
End Class
End Namespace

View File

@@ -530,5 +530,8 @@
<Setting Name="UpdateChannel" Provider="mRemoteNG.Config.Settings.Providers.ChooseProvider" Type="System.String" Scope="Application">
<Value Profile="(Default)">release</Value>
</Setting>
<Setting Name="ThemeName" Provider="mRemoteNG.Config.Settings.Providers.ChooseProvider" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View File

@@ -16,6 +16,22 @@ Namespace Themes
Public Overrides Function ToString() As String
Return Name
End Function
Public Overrides Function Equals(obj As Object) As Boolean
Dim otherTheme As ThemeInfo = TryCast(obj, ThemeInfo)
If otherTheme Is Nothing Then Return False
Dim themeInfoType As Type = (New ThemeInfo).GetType()
Dim myProperty As Object
Dim otherProperty As Object
For Each propertyInfo As Reflection.PropertyInfo In themeInfoType.GetProperties()
myProperty = propertyInfo.GetValue(Me, Nothing)
otherProperty = propertyInfo.GetValue(otherTheme, Nothing)
If Not myProperty.Equals(otherProperty) Then Return False
Next
Return True
End Function
#End Region
#Region "Events"

View File

@@ -4,6 +4,22 @@ Imports System.ComponentModel
Namespace Themes
Public Class ThemeManager
#Region "Public Methods"
Public Shared Function LoadTheme(ByVal themeName As String, Optional ByVal setActive As Boolean = True) As ThemeInfo
Dim loadedTheme As ThemeInfo = DefaultTheme
If Not String.IsNullOrEmpty(themeName) Then
For Each theme As ThemeInfo In LoadThemes()
If theme.Name = themeName Then
loadedTheme = theme
Exit For
End If
Next
End If
If setActive Then ActiveTheme = loadedTheme
Return loadedTheme
End Function
Public Shared Function LoadThemes() As List(Of ThemeInfo)
Dim themes As New List(Of ThemeInfo)
themes.Add(DefaultTheme)

View File

@@ -565,6 +565,9 @@
<setting name="IdentifyQuickConnectTabs" serializeAs="String">
<value>False</value>
</setting>
<setting name="ThemeName" serializeAs="String">
<value />
</setting>
</mRemoteNG.My.MySettings>
</userSettings>
<applicationSettings>