mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
More theme improvements.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
13
mRemoteV1/My Project/Settings.Designer.vb
generated
13
mRemoteV1/My Project/Settings.Designer.vb
generated
@@ -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
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user