@@ -51,7 +51,7 @@ public partial class MainWindow : Window
51
51
string adbLogCatArgs = defaultAdbLogCatArgs ;
52
52
53
53
Dictionary < string , SolidColorBrush > origResourceColors = new Dictionary < string , SolidColorBrush > ( ) ;
54
- string themefile = "theme.ini" ;
54
+
55
55
string latestBuildReportProjectPath = null ;
56
56
57
57
[ DllImport ( "user32" , CharSet = CharSet . Unicode ) ]
@@ -66,13 +66,11 @@ public partial class MainWindow : Window
66
66
public MainWindow ( )
67
67
{
68
68
InitializeComponent ( ) ;
69
- Start ( ) ;
69
+ Init ( ) ;
70
70
}
71
71
72
- void Start ( )
72
+ void Init ( )
73
73
{
74
- LoadSettings ( ) ;
75
-
76
74
// disable accesskeys without alt
77
75
CoreCompatibilityPreferences . IsAltKeyRequiredInAccessKeyDefaultScope = true ;
78
76
@@ -81,6 +79,11 @@ void Start()
81
79
Resizable_BorderLess_Chrome . CornerRadius = new CornerRadius ( 0 ) ;
82
80
Resizable_BorderLess_Chrome . CaptionHeight = 1.0 ;
83
81
WindowChrome . SetWindowChrome ( this , Resizable_BorderLess_Chrome ) ;
82
+ }
83
+
84
+ void Start ( )
85
+ {
86
+ LoadSettings ( ) ;
84
87
85
88
// get unity installations
86
89
dataGridUnitys . Items . Clear ( ) ;
@@ -122,7 +125,7 @@ void Start()
122
125
origResourceColors [ item . Key . ToString ( ) ] = ( SolidColorBrush ) item . Value ;
123
126
}
124
127
125
- ApplyTheme ( ) ;
128
+ ApplyTheme ( txtCustomThemeFile . Text ) ;
126
129
127
130
// for autostart with minimized
128
131
if ( Properties . Settings . Default . runAutomatically == true && Properties . Settings . Default . runAutomaticallyMinimized == true )
@@ -311,8 +314,7 @@ void LoadSettings()
311
314
chkUseCustomTheme . IsChecked = Properties . Settings . Default . useCustomTheme ;
312
315
txtRootFolderForNewProjects . Text = Properties . Settings . Default . newProjectsRoot ;
313
316
txtWebglRelativePath . Text = Properties . Settings . Default . webglBuildPath ;
314
- themefile = Properties . Settings . Default . themeFile ;
315
- txtCustomThemeFile . Text = themefile ;
317
+ txtCustomThemeFile . Text = Properties . Settings . Default . themeFile ;
316
318
317
319
chkEnablePlatformSelection . IsChecked = Properties . Settings . Default . enablePlatformSelection ;
318
320
chkRunAutomatically . IsChecked = Properties . Settings . Default . runAutomatically ;
@@ -1997,15 +1999,17 @@ private void MenuItemBrowsePersistentDataPath_Click(object sender, RoutedEventAr
1997
1999
}
1998
2000
}
1999
2001
2000
- void ApplyTheme ( )
2002
+ void ApplyTheme ( string themeFile )
2001
2003
{
2002
2004
if ( chkUseCustomTheme . IsChecked == false ) return ;
2003
2005
2004
2006
//Console.WriteLine("Load theme: " + themefile);
2005
2007
2006
- if ( File . Exists ( themefile ) == true )
2008
+ themeFile = "Themes/" + themeFile ;
2009
+
2010
+ if ( File . Exists ( themeFile ) == true )
2007
2011
{
2008
- var colors = File . ReadAllLines ( themefile ) ;
2012
+ var colors = File . ReadAllLines ( themeFile ) ;
2009
2013
2010
2014
// parse lines
2011
2015
for ( int i = 0 , length = colors . Length ; i < length ; i ++ )
@@ -2034,7 +2038,7 @@ void ApplyTheme()
2034
2038
}
2035
2039
else
2036
2040
{
2037
- Console . WriteLine ( "Theme file not found: " + themefile ) ;
2041
+ Console . WriteLine ( "Theme file not found: " + themeFile ) ;
2038
2042
}
2039
2043
}
2040
2044
@@ -2059,7 +2063,7 @@ private void ChkUseCustomTheme_Checked(object sender, RoutedEventArgs e)
2059
2063
// reset colors now
2060
2064
if ( isChecked == true )
2061
2065
{
2062
- ApplyTheme ( ) ;
2066
+ ApplyTheme ( txtCustomThemeFile . Text ) ;
2063
2067
}
2064
2068
else
2065
2069
{
@@ -2069,14 +2073,13 @@ private void ChkUseCustomTheme_Checked(object sender, RoutedEventArgs e)
2069
2073
2070
2074
private void BtnReloadTheme_Click ( object sender , RoutedEventArgs e )
2071
2075
{
2072
- ApplyTheme ( ) ;
2076
+ ApplyTheme ( txtCustomThemeFile . Text ) ;
2073
2077
}
2074
2078
2075
2079
private void TxtCustomThemeFile_LostFocus ( object sender , RoutedEventArgs e )
2076
2080
{
2077
2081
var s = ( TextBox ) sender ;
2078
- themefile = s . Text ;
2079
- Properties . Settings . Default . themeFile = themefile ;
2082
+ Properties . Settings . Default . themeFile = s . Text ;
2080
2083
Properties . Settings . Default . Save ( ) ;
2081
2084
}
2082
2085
@@ -2085,8 +2088,7 @@ private void TxtCustomThemeFile_PreviewKeyDown(object sender, KeyEventArgs e)
2085
2088
switch ( e . Key )
2086
2089
{
2087
2090
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 ;
2090
2092
Properties . Settings . Default . Save ( ) ;
2091
2093
btnReloadTheme . Focus ( ) ;
2092
2094
break ;
@@ -2095,7 +2097,7 @@ private void TxtCustomThemeFile_PreviewKeyDown(object sender, KeyEventArgs e)
2095
2097
2096
2098
private void BtnExploreFolder_Click ( object sender , RoutedEventArgs e )
2097
2099
{
2098
- Tools . LaunchExplorer ( System . AppDomain . CurrentDomain . BaseDirectory ) ;
2100
+ Tools . LaunchExplorer ( Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "Themes" ) ) ;
2099
2101
}
2100
2102
2101
2103
private void ChkEnablePlatformSelection_Checked ( object sender , RoutedEventArgs e )
@@ -2394,6 +2396,12 @@ private void MenuItemDownloadWebGLModule_Click(object sender, RoutedEventArgs e)
2394
2396
if ( unity == null ) return ;
2395
2397
Tools . DownloadAdditionalModules ( unity . Path , unity . Version , "WebGL" ) ;
2396
2398
}
2399
+
2400
+ private void Window_Loaded ( object sender , RoutedEventArgs e )
2401
+ {
2402
+ Start ( ) ;
2403
+
2404
+ }
2397
2405
} // class
2398
2406
} //namespace
2399
2407
0 commit comments