@@ -51,7 +51,7 @@ public partial class MainWindow : Window
5151 string adbLogCatArgs = defaultAdbLogCatArgs ;
5252
5353 Dictionary < string , SolidColorBrush > origResourceColors = new Dictionary < string , SolidColorBrush > ( ) ;
54- string themefile = "theme.ini" ;
54+
5555 string latestBuildReportProjectPath = null ;
5656
5757 [ DllImport ( "user32" , CharSet = CharSet . Unicode ) ]
@@ -66,13 +66,11 @@ public partial class MainWindow : Window
6666 public MainWindow ( )
6767 {
6868 InitializeComponent ( ) ;
69- Start ( ) ;
69+ Init ( ) ;
7070 }
7171
72- void Start ( )
72+ void Init ( )
7373 {
74- LoadSettings ( ) ;
75-
7674 // disable accesskeys without alt
7775 CoreCompatibilityPreferences . IsAltKeyRequiredInAccessKeyDefaultScope = true ;
7876
@@ -81,6 +79,11 @@ void Start()
8179 Resizable_BorderLess_Chrome . CornerRadius = new CornerRadius ( 0 ) ;
8280 Resizable_BorderLess_Chrome . CaptionHeight = 1.0 ;
8381 WindowChrome . SetWindowChrome ( this , Resizable_BorderLess_Chrome ) ;
82+ }
83+
84+ void Start ( )
85+ {
86+ LoadSettings ( ) ;
8487
8588 // get unity installations
8689 dataGridUnitys . Items . Clear ( ) ;
@@ -122,7 +125,7 @@ void Start()
122125 origResourceColors [ item . Key . ToString ( ) ] = ( SolidColorBrush ) item . Value ;
123126 }
124127
125- ApplyTheme ( ) ;
128+ ApplyTheme ( txtCustomThemeFile . Text ) ;
126129
127130 // for autostart with minimized
128131 if ( Properties . Settings . Default . runAutomatically == true && Properties . Settings . Default . runAutomaticallyMinimized == true )
@@ -311,8 +314,7 @@ void LoadSettings()
311314 chkUseCustomTheme . IsChecked = Properties . Settings . Default . useCustomTheme ;
312315 txtRootFolderForNewProjects . Text = Properties . Settings . Default . newProjectsRoot ;
313316 txtWebglRelativePath . Text = Properties . Settings . Default . webglBuildPath ;
314- themefile = Properties . Settings . Default . themeFile ;
315- txtCustomThemeFile . Text = themefile ;
317+ txtCustomThemeFile . Text = Properties . Settings . Default . themeFile ;
316318
317319 chkEnablePlatformSelection . IsChecked = Properties . Settings . Default . enablePlatformSelection ;
318320 chkRunAutomatically . IsChecked = Properties . Settings . Default . runAutomatically ;
@@ -1997,15 +1999,17 @@ private void MenuItemBrowsePersistentDataPath_Click(object sender, RoutedEventAr
19971999 }
19982000 }
19992001
2000- void ApplyTheme ( )
2002+ void ApplyTheme ( string themeFile )
20012003 {
20022004 if ( chkUseCustomTheme . IsChecked == false ) return ;
20032005
20042006 //Console.WriteLine("Load theme: " + themefile);
20052007
2006- if ( File . Exists ( themefile ) == true )
2008+ themeFile = "Themes/" + themeFile ;
2009+
2010+ if ( File . Exists ( themeFile ) == true )
20072011 {
2008- var colors = File . ReadAllLines ( themefile ) ;
2012+ var colors = File . ReadAllLines ( themeFile ) ;
20092013
20102014 // parse lines
20112015 for ( int i = 0 , length = colors . Length ; i < length ; i ++ )
@@ -2034,7 +2038,7 @@ void ApplyTheme()
20342038 }
20352039 else
20362040 {
2037- Console . WriteLine ( "Theme file not found: " + themefile ) ;
2041+ Console . WriteLine ( "Theme file not found: " + themeFile ) ;
20382042 }
20392043 }
20402044
@@ -2059,7 +2063,7 @@ private void ChkUseCustomTheme_Checked(object sender, RoutedEventArgs e)
20592063 // reset colors now
20602064 if ( isChecked == true )
20612065 {
2062- ApplyTheme ( ) ;
2066+ ApplyTheme ( txtCustomThemeFile . Text ) ;
20632067 }
20642068 else
20652069 {
@@ -2069,14 +2073,13 @@ private void ChkUseCustomTheme_Checked(object sender, RoutedEventArgs e)
20692073
20702074 private void BtnReloadTheme_Click ( object sender , RoutedEventArgs e )
20712075 {
2072- ApplyTheme ( ) ;
2076+ ApplyTheme ( txtCustomThemeFile . Text ) ;
20732077 }
20742078
20752079 private void TxtCustomThemeFile_LostFocus ( object sender , RoutedEventArgs e )
20762080 {
20772081 var s = ( TextBox ) sender ;
2078- themefile = s . Text ;
2079- Properties . Settings . Default . themeFile = themefile ;
2082+ Properties . Settings . Default . themeFile = s . Text ;
20802083 Properties . Settings . Default . Save ( ) ;
20812084 }
20822085
@@ -2085,8 +2088,7 @@ private void TxtCustomThemeFile_PreviewKeyDown(object sender, KeyEventArgs e)
20852088 switch ( e . Key )
20862089 {
20872090 case Key . Return : // pressed enter in theme file text box
2088- themefile = txtCustomThemeFile . Text ;
2089- Properties . Settings . Default . themeFile = themefile ;
2091+ Properties . Settings . Default . themeFile = txtCustomThemeFile . Text ;
20902092 Properties . Settings . Default . Save ( ) ;
20912093 btnReloadTheme . Focus ( ) ;
20922094 break ;
@@ -2095,7 +2097,7 @@ private void TxtCustomThemeFile_PreviewKeyDown(object sender, KeyEventArgs e)
20952097
20962098 private void BtnExploreFolder_Click ( object sender , RoutedEventArgs e )
20972099 {
2098- Tools . LaunchExplorer ( System . AppDomain . CurrentDomain . BaseDirectory ) ;
2100+ Tools . LaunchExplorer ( Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "Themes" ) ) ;
20992101 }
21002102
21012103 private void ChkEnablePlatformSelection_Checked ( object sender , RoutedEventArgs e )
@@ -2394,6 +2396,12 @@ private void MenuItemDownloadWebGLModule_Click(object sender, RoutedEventArgs e)
23942396 if ( unity == null ) return ;
23952397 Tools . DownloadAdditionalModules ( unity . Path , unity . Version , "WebGL" ) ;
23962398 }
2399+
2400+ private void Window_Loaded ( object sender , RoutedEventArgs e )
2401+ {
2402+ Start ( ) ;
2403+
2404+ }
23972405 } // class
23982406} //namespace
23992407
0 commit comments