@@ -139,7 +139,6 @@ public void RefreshFrame()
139139 HwndSource mainWindowSrc = HwndSource . FromHwnd ( mainWindowPtr ) ;
140140 if ( mainWindowSrc == null )
141141 return ;
142- //mainWindowSrc.CompositionTarget.BackgroundColor = Color.FromArgb(0, 255, 181, 178);
143142
144143 ParameterTypes . MARGINS margins = new ParameterTypes . MARGINS ( ) ;
145144 margins . cxLeftWidth = - 1 ;
@@ -154,26 +153,17 @@ public void RefreshFrame()
154153 //Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, 0x00FF0000);
155154 //Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
156155
157- //if (!_settings.UseDropShadowEffect && BlurEnabled)
158- //{
159- // _settings.UseDropShadowEffect = true;
160- // AddDropShadowEffectToCurrentTheme();
161- //}
162-
163- //if (_settings.UseDropShadowEffect)
164- //{
165- // AddDropShadowEffectToCurrentTheme();
166- //}
167- //AutoDropShadow();
156+ // The timing of adding the shadow effect should vary depending on whether the theme is transparent.
157+ if ( BlurEnabled )
158+ {
159+ AutoDropShadow ( ) ;
160+ }
168161 SetBlurForWindow ( ) ;
169162
170- //else if (!_settings.usedropshadoweffect && blurenabled)
171- //{
172- // adddropshadoweffecttocurrenttheme();
173- // _settings.usedropshadoweffect = true;
174- //}
175-
176- //SetCornerForWindow();
163+ if ( ! BlurEnabled )
164+ {
165+ AutoDropShadow ( ) ;
166+ }
177167 }
178168
179169 public void AutoDropShadow ( )
@@ -183,13 +173,11 @@ public void AutoDropShadow()
183173 RemoveDropShadowEffectFromCurrentTheme ( ) ;
184174 if ( BlurEnabled )
185175 {
186- Debug . WriteLine ( "이거는 블러있는 테마이므로 외곽선 주고 그림자" ) ;
187176 SetWindowCornerPreference ( "Round" ) ;
188177 }
189178 else
190179 {
191180 SetWindowCornerPreference ( "Default" ) ;
192- Debug . WriteLine ( "이거는 블러없는 테마" ) ;
193181 AddDropShadowEffectToCurrentTheme ( ) ;
194182 }
195183 }
@@ -251,7 +239,7 @@ public void SetCornerForWindow()
251239 /// </summary>
252240 public void SetBlurForWindow ( )
253241 {
254- //AutoDropShadow();
242+
255243 //SetWindowAccent();
256244 var dict = GetThemeResourceDictionary ( _settings . Theme ) ;
257245 if ( dict == null )
@@ -270,7 +258,7 @@ public void SetBlurForWindow()
270258 windowBorderStyle . Setters . Remove ( windowBorderStyle . Setters . OfType < Setter > ( ) . FirstOrDefault ( x => x . Property . Name == "Background" ) ) ;
271259 windowBorderStyle . Setters . Add ( new Setter ( Border . BackgroundProperty , new SolidColorBrush ( Colors . Transparent ) ) ) ;
272260 Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_SYSTEMBACKDROP_TYPE , 3 ) ;
273- SetWindowCornerPreference ( "Round" ) ;
261+ // SetWindowCornerPreference("Round");
274262 }
275263 else
276264 {
@@ -280,27 +268,15 @@ public void SetBlurForWindow()
280268 // windowBorderStyle.Setters.Add(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
281269 //}
282270 Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_SYSTEMBACKDROP_TYPE , 1 ) ;
283- SetWindowCornerPreference ( "Default" ) ;
284- if ( _settings . UseDropShadowEffect )
285- {
286-
287- AddDropShadowEffectToCurrentTheme ( ) ;
288- }
289- else
290- {
291- RemoveDropShadowEffectFromCurrentTheme ( ) ;
292- }
293-
294271 }
295272 ThemeModeColor ( BlurMode ( ) ) ;
296-
297273 UpdateResourceDictionary ( dict ) ;
298274
299275
300276
301277 }
302278
303- // WindowBorderStyle에서 Background 색상 가져오는 함수
279+ // Get Background Color from WindowBorderStyle when there not color for BG.
304280 private Color GetWindowBorderStyleBackground ( )
305281 {
306282 var Resources = GetThemeResourceDictionary ( _settings . Theme ) ;
@@ -312,19 +288,19 @@ private Color GetWindowBorderStyleBackground()
312288
313289 if ( backgroundSetter != null )
314290 {
315- // Background의 Value가 DynamicColor일 경우 처리
291+ // Background's Value is DynamicColor Case
316292 var backgroundValue = backgroundSetter . Value ;
317293
318294 if ( backgroundValue is SolidColorBrush solidColorBrush )
319295 {
320- return solidColorBrush . Color ; // SolidColorBrush의 Color 반환
296+ return solidColorBrush . Color ; // Return SolidColorBrush's Color
321297 }
322298 else if ( backgroundValue is DynamicResourceExtension dynamicResource )
323299 {
324- // DynamicResource Extension을 처리할 때, Key는 리소스에 대한 이름입니다 .
300+ // When DynamicResource Extension it is, Key is resource's name .
325301 var resourceKey = backgroundSetter . Value . ToString ( ) ;
326302
327- // 리소스에서 해당 키를 찾아 색상 반환
303+ // find key in resource and return color.
328304 if ( Resources . Contains ( resourceKey ) )
329305 {
330306 var colorResource = Resources [ resourceKey ] ;
@@ -340,7 +316,7 @@ private Color GetWindowBorderStyleBackground()
340316 }
341317 }
342318
343- return Colors . Transparent ; // 기본값: 투명
319+ return Colors . Transparent ; // Default is transparent
344320 }
345321
346322 public void ThemeModeColor ( string Mode )
@@ -350,34 +326,33 @@ public void ThemeModeColor(string Mode)
350326 Color lightBG ;
351327 Color darkBG ;
352328
353- // lightBG 값을 가져오기 (없으면 WindowBorderStyle의 Background 값 사용)
329+ // get lightBG value. if not, get windowborderstyle's background.
354330 try
355331 {
356- // dict["lightBG"] 값이 없거나 null이면 WindowBorderStyle의 Background 값 사용
357332 lightBG = dict . Contains ( "lightBG" ) ? ( Color ) dict [ "lightBG" ] : GetWindowBorderStyleBackground ( ) ;
358333 }
359334 catch ( Exception )
360335 {
361- // lightBG가 없으면 WindowBorderStyle의 Background 값 사용
336+ // if not lightBG, use windowborderstyle's background.
362337 lightBG = GetWindowBorderStyleBackground ( ) ;
363338 }
364339
365- // darkBG 값을 가져오기 (없으면 lightBG 값으로 설정 )
340+ // get darkBG value, (if not, use lightBG )
366341 try
367342 {
368343 darkBG = dict . Contains ( "darkBG" ) ? ( Color ) dict [ "darkBG" ] : lightBG ;
369344 }
370345 catch ( Exception )
371346 {
372- darkBG = lightBG ; // darkBG가 없으면 lightBG 값을 사용
347+ darkBG = lightBG ; // if not darkBG, use lightBG
373348 }
374349
375350
376351 if ( Mode == "Auto" )
377352 {
378353 int themeValue = ( int ) Registry . GetValue ( @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" , "AppsUseLightTheme" , 1 ) ;
379354 string colorScheme = _settings . ColorScheme ;
380- bool isDarkMode = themeValue == 0 ; // 0이면 다크 모드
355+ bool isDarkMode = themeValue == 0 ; // 0 is dark mode.
381356 if ( colorScheme == "System" )
382357 {
383358 if ( isDarkMode )
@@ -423,39 +398,9 @@ public void ThemeModeColor(string Mode)
423398 }
424399 else
425400 {
426- //Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0);
427401 mainWindow . Background = new SolidColorBrush ( Colors . Transparent ) ;
428402 }
429403 }
430- public void BlurColor ( string Color )
431- {
432-
433- if ( Color == "Light" )
434- {
435- //mainWindow.Background = new SolidColorBrush(defaultBGcolor.Value);
436- Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_USE_IMMERSIVE_DARK_MODE , 0 ) ;
437- }
438- else if ( Color == "Dark" )
439- {
440- //mainWindow.Background = new SolidColorBrush(darkBGcolor.Value);
441- Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_USE_IMMERSIVE_DARK_MODE , 1 ) ;
442- }
443- else /* Case of "Auto" Blur Type Theme */
444- {
445- //if (_isDarkTheme())
446- //{
447- // mainWindow.Background = new SolidColorBrush(darkBGcolor.Value);
448- // Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1);
449- //}
450- //else
451- //{
452- // mainWindow.Background = new SolidColorBrush(defaultBGcolor.Value);
453- // Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0);
454- //}
455- //mainWindow.Background = new SolidColorBrush(Colors.Red);
456- Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_USE_IMMERSIVE_DARK_MODE , 1 ) ; }
457-
458- }
459404
460405 public bool IsBlurTheme ( )
461406 {
@@ -486,24 +431,6 @@ public string BlurMode()
486431 return null ;
487432 }
488433
489- //public SolidColorBrush BGColor(string colorBgKey)
490- //{
491- // var defaultBG = Application.Current.TryFindResource("DefaultBG");
492- // var darkBG = Application.Current.TryFindResource("DarkBG");
493-
494- // if (colorBgKey == "")
495- // {
496- // var resource = Application.Current.TryFindResource("BlurMode");
497-
498- // if (resource is string)
499- // return (SolidColorBrush)resource;
500-
501- // return new SolidColorBrush(Colors.DarkGray);
502- // }
503-
504- // return null;
505- //}
506-
507434 #endregion
508435
509436 private void MakeSureThemeDirectoriesExist ( )
0 commit comments