@@ -14,6 +14,12 @@ public class NodejsGeneralOptionsPage : NodejsDialogPage
1414 private const string CheckForLongPathsSetting = "CheckForLongPaths" ;
1515
1616 private NodejsGeneralOptionsControl _window ;
17+ private bool _waitOnAbnormalExit ;
18+ private bool _waitOnNormalExit ;
19+ private bool _editAndContinue ;
20+ private bool _waitOnAbnormalExitModified ;
21+ private bool _waitOnNormalExitModified ;
22+ private bool _editAndContinueModified ;
1723
1824 public NodejsGeneralOptionsPage ( )
1925 : base ( "General" )
@@ -38,18 +44,42 @@ protected override IWin32Window Window
3844 /// True if Node processes should pause for input before exiting
3945 /// if they exit abnormally.
4046 /// </summary>
41- public bool WaitOnAbnormalExit { get ; set ; }
47+ public bool WaitOnAbnormalExit
48+ {
49+ get => this . _waitOnAbnormalExit ;
50+ set
51+ {
52+ this . _waitOnAbnormalExit = value ;
53+ this . _waitOnAbnormalExitModified = true ;
54+ }
55+ }
4256
4357 /// <summary>
4458 /// True if Node processes should pause for input before exiting
4559 /// if they exit normally.
4660 /// </summary>
47- public bool WaitOnNormalExit { get ; set ; }
61+ public bool WaitOnNormalExit
62+ {
63+ get => this . _waitOnNormalExit ;
64+ set
65+ {
66+ this . _waitOnNormalExit = value ;
67+ this . _waitOnNormalExitModified = true ;
68+ }
69+ }
4870
4971 /// <summary>
5072 /// Indicates whether Edit and Continue feature should be enabled.
5173 /// </summary>
52- public bool EditAndContinue { get ; set ; }
74+ public bool EditAndContinue
75+ {
76+ get => this . _editAndContinue ;
77+ set
78+ {
79+ this . _editAndContinue = value ;
80+ this . _editAndContinueModified = true ;
81+ }
82+ }
5383
5484 /// <summary>
5585 /// Resets settings back to their defaults. This should be followed by
@@ -65,12 +95,36 @@ public override void ResetSettings()
6595
6696 public override void LoadSettingsFromStorage ( )
6797 {
68- // Load settings from storage.
69- this . WaitOnAbnormalExit = LoadBool ( WaitOnAbnormalExitSetting ) ?? true ;
70- this . WaitOnNormalExit = LoadBool ( WaitOnNormalExitSetting ) ?? false ;
71- this . EditAndContinue = LoadBool ( EditAndContinueSetting ) ?? true ;
98+ this . _waitOnAbnormalExit = LoadBool ( WaitOnAbnormalExitSetting ) ?? true ;
99+ this . _waitOnNormalExit = LoadBool ( WaitOnNormalExitSetting ) ?? false ;
100+ this . _editAndContinue = LoadBool ( EditAndContinueSetting ) ?? true ;
101+ this . _waitOnAbnormalExitModified = false ;
102+ this . _waitOnNormalExitModified = false ;
103+ this . _editAndContinueModified = false ;
104+
105+ if ( this . _window != null )
106+ {
107+ this . _window . SyncControlWithPageSettings ( this ) ;
108+ }
109+ }
110+
111+ internal void RefreshSettingsFromStorage ( )
112+ {
113+ if ( ! this . _waitOnAbnormalExitModified )
114+ {
115+ this . _waitOnAbnormalExit = LoadBool ( WaitOnAbnormalExitSetting ) ?? true ;
116+ }
117+
118+ if ( ! this . _waitOnNormalExitModified )
119+ {
120+ this . _waitOnNormalExit = LoadBool ( WaitOnNormalExitSetting ) ?? false ;
121+ }
122+
123+ if ( ! this . _editAndContinueModified )
124+ {
125+ this . _editAndContinue = LoadBool ( EditAndContinueSetting ) ?? true ;
126+ }
72127
73- // Synchronize UI with backing properties.
74128 if ( this . _window != null )
75129 {
76130 this . _window . SyncControlWithPageSettings ( this ) ;
@@ -79,16 +133,17 @@ public override void LoadSettingsFromStorage()
79133
80134 public override void SaveSettingsToStorage ( )
81135 {
82- // Synchronize backing properties with UI.
83136 if ( this . _window != null )
84137 {
85138 this . _window . SyncPageWithControlSettings ( this ) ;
86139 }
87140
88- // Save settings.
89141 SaveBool ( WaitOnNormalExitSetting , this . WaitOnNormalExit ) ;
90142 SaveBool ( WaitOnAbnormalExitSetting , this . WaitOnAbnormalExit ) ;
91143 SaveBool ( EditAndContinueSetting , this . EditAndContinue ) ;
144+ this . _waitOnAbnormalExitModified = false ;
145+ this . _waitOnNormalExitModified = false ;
146+ this . _editAndContinueModified = false ;
92147 }
93148 }
94149}
0 commit comments