mirror of https://github.com/icsharpcode/ILSpy.git
20 changed files with 138 additions and 22 deletions
@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
|
||||
using System.Windows; |
||||
|
||||
namespace ICSharpCode.ILSpy.themes |
||||
namespace ICSharpCode.ILSpy.Themes |
||||
{ |
||||
public static class ResourceKeys |
||||
{ |
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
using System.ComponentModel; |
||||
using System.Windows; |
||||
|
||||
using ICSharpCode.ILSpy.Options; |
||||
|
||||
using TomsToolbox.Wpf; |
||||
using TomsToolbox.Wpf.Interactivity; |
||||
|
||||
namespace ICSharpCode.ILSpy.Themes |
||||
{ |
||||
public class WindowStyleManagerBehavior : FrameworkElementBehavior<Window> |
||||
{ |
||||
private static readonly DispatcherThrottle restartNotificationThrottle = new DispatcherThrottle(ShowRestartNotification); |
||||
|
||||
protected override void OnAttached() |
||||
{ |
||||
base.OnAttached(); |
||||
|
||||
DisplaySettingsPanel.CurrentDisplaySettings.PropertyChanged += DisplaySettings_PropertyChanged; |
||||
|
||||
UpdateWindowStyle(); |
||||
|
||||
} |
||||
|
||||
protected override void OnDetaching() |
||||
{ |
||||
base.OnDetaching(); |
||||
|
||||
DisplaySettingsPanel.CurrentDisplaySettings.PropertyChanged -= DisplaySettings_PropertyChanged; |
||||
} |
||||
|
||||
private void UpdateWindowStyle() |
||||
{ |
||||
if (!DisplaySettingsPanel.CurrentDisplaySettings.StyleWindowTitleBar) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
var window = AssociatedObject; |
||||
window.Style = (Style)window.FindResource(TomsToolbox.Wpf.Styles.ResourceKeys.WindowStyle); |
||||
} |
||||
|
||||
private static void ShowRestartNotification() |
||||
{ |
||||
MessageBox.Show(Properties.Resources.SettingsChangeRestartRequired); |
||||
} |
||||
|
||||
private void DisplaySettings_PropertyChanged(object sender, PropertyChangedEventArgs e) |
||||
{ |
||||
if (e.PropertyName == nameof(DisplaySettings.StyleWindowTitleBar)) |
||||
{ |
||||
if (!DisplaySettingsPanel.CurrentDisplaySettings.StyleWindowTitleBar) |
||||
{ |
||||
restartNotificationThrottle.Tick(); |
||||
return; |
||||
} |
||||
|
||||
UpdateWindowStyle(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,7 +1,7 @@
@@ -1,7 +1,7 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:controls="clr-namespace:ICSharpCode.ILSpy.Controls" |
||||
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.themes"> |
||||
xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes"> |
||||
<ResourceDictionary.MergedDictionaries> |
||||
<ResourceDictionary Source="../Controls/SearchBoxStyle.xaml" /> |
||||
</ResourceDictionary.MergedDictionaries> |
Loading…
Reference in new issue