@@ -72,7 +72,7 @@ namespace ICSharpCode.ILSpy.TextView
72
72
/// Manages the TextEditor showing the decompiled code.
73
73
/// Contains all the threading logic that makes the decompiler work in the background.
74
74
/// </summary>
75
- public sealed partial class DecompilerTextView : UserControl , IDisposable , IHaveState , IProgress < DecompilationProgress >
75
+ public sealed partial class DecompilerTextView : UserControl , IHaveState , IProgress < DecompilationProgress >
76
76
{
77
77
readonly ReferenceElementGenerator referenceElementGenerator ;
78
78
readonly UIElementGenerator uiElementGenerator ;
@@ -125,7 +125,8 @@ public DecompilerTextView()
125
125
textEditor . TextArea . TextView . BackgroundRenderers . Add ( textMarkerService ) ;
126
126
textEditor . TextArea . TextView . LineTransformers . Add ( textMarkerService ) ;
127
127
textEditor . ShowLineNumbers = true ;
128
- SettingsService . Instance . DisplaySettings . PropertyChanged += CurrentDisplaySettings_PropertyChanged ;
128
+
129
+ MessageBus < SettingsChangedEventArgs > . Subscribers += Settings_Changed ;
129
130
130
131
// SearchPanel
131
132
SearchPanel searchPanel = SearchPanel . Install ( textEditor . TextArea ) ;
@@ -179,15 +180,24 @@ void RemoveEditCommand(RoutedUICommand command)
179
180
180
181
#region Line margin
181
182
182
- void CurrentDisplaySettings_PropertyChanged ( object ? sender , PropertyChangedEventArgs e )
183
+ private void Settings_Changed ( object ? sender , SettingsChangedEventArgs e )
183
184
{
184
- if ( e . PropertyName == nameof ( DisplaySettings . ShowLineNumbers ) )
185
- {
186
- ShowLineMargin ( ) ;
187
- }
188
- else if ( e . PropertyName == nameof ( DisplaySettings . HighlightCurrentLine ) )
185
+ Settings_PropertyChanged ( sender , e ) ;
186
+ }
187
+
188
+ private void Settings_PropertyChanged ( object ? sender , PropertyChangedEventArgs e )
189
+ {
190
+ if ( sender is not DisplaySettings )
191
+ return ;
192
+
193
+ switch ( e . PropertyName )
189
194
{
190
- SetHighlightCurrentLine ( ) ;
195
+ case nameof ( DisplaySettings . ShowLineNumbers ) :
196
+ ShowLineMargin ( ) ;
197
+ break ;
198
+ case nameof ( DisplaySettings . HighlightCurrentLine ) :
199
+ SetHighlightCurrentLine ( ) ;
200
+ break ;
191
201
}
192
202
}
193
203
@@ -1286,12 +1296,6 @@ public static void RegisterHighlighting()
1286
1296
HighlightingManager . Instance . RegisterHighlighting ( "xml" , new [ ] { ".xml" , ".baml" } , "XML-Mode" ) ;
1287
1297
}
1288
1298
1289
-
1290
- public void Dispose ( )
1291
- {
1292
- SettingsService . Instance . DisplaySettings . PropertyChanged -= CurrentDisplaySettings_PropertyChanged ;
1293
- }
1294
-
1295
1299
#region Unfold
1296
1300
public void UnfoldAndScroll ( int lineNumber )
1297
1301
{
0 commit comments