Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bb7fb4d

Browse files
optimize startup #54 (remove origResourceColors)
1 parent d46c20f commit bb7fb4d

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

‎UnityLauncherPro/MainWindow.xaml.cs‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ public partial class MainWindow : Window
6666
string defaultDateFormat = "dd/MM/yyyy HH:mm:ss";
6767
string adbLogCatArgs = defaultAdbLogCatArgs;
6868

69-
Dictionary<string, SolidColorBrush> origResourceColors = new Dictionary<string, SolidColorBrush>();
70-
7169
string currentBuildReportProjectPath = null;
7270
string currentBuildPluginsRelativePath = null;
7371
//List<List<string>> buildReports = new List<List<string>>();
@@ -168,12 +166,6 @@ void Start()
168166
// build notifyicon (using windows.forms)
169167
notifyIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(NotifyIcon_MouseClick);
170168

171-
// get original colors
172-
foreach (DictionaryEntry item in Application.Current.Resources.MergedDictionaries[0])
173-
{
174-
origResourceColors[item.Key.ToString()] = (SolidColorBrush)item.Value;
175-
}
176-
177169
ApplyTheme(txtCustomThemeFile.Text);
178170

179171
// for autostart with minimized
@@ -198,7 +190,7 @@ void Start()
198190
if (Settings.Default.disableUnityHubLaunch == true) StartHubPipe();
199191

200192
isInitializing = false;
201-
}
193+
}// Start()
202194

203195
private static NamedPipeServerStream hubPipeServer;
204196
private CancellationTokenSource _hubCancellationTokenSource;
@@ -2762,9 +2754,12 @@ void ApplyTheme(string themeFile)
27622754

27632755
void ResetTheme()
27642756
{
2765-
foreach (KeyValuePair<string,SolidColorBrush>item in origResourceColors)
2757+
foreach (DictionaryEntryitem in Application.Current.Resources.MergedDictionaries[0])
27662758
{
2767-
Application.Current.Resources[item.Key] = item.Value;
2759+
if (item.Key is string key && item.Value is SolidColorBrush brush)
2760+
{
2761+
Application.Current.Resources[key] = brush;
2762+
}
27682763
}
27692764
}
27702765

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /