@@ -46,21 +46,31 @@ public OptionsPage(OptionPageGrid optionPageGrid)
4646 comboBox . LostKeyboardFocus += ComboBox_LostKeyboardFocus ;
4747 }
4848
49+ string bindingPath ;
4950 foreach ( var textBox in grpPersistence . FindChildren < TextBox > ( ) )
5051 {
51- var bindingPath = ( textBox ) . GetBindingExpression ( TextBox . TextProperty ) ? . ParentBinding ? . Path ? . Path ;
52+ bindingPath = textBox . GetBindingExpression ( TextBox . TextProperty ) ? . ParentBinding ? . Path ? . Path ;
5253
5354 if ( bindingPath != null )
5455 {
5556 TextBoxIsValidTaskCancelSources . Add ( textBox , new CancellationTokenSource ( ) ) ;
5657 textBox . LostKeyboardFocus += PersistencePropertyBoundTextBox_KeyboardLostFocus ;
57- textBox . TextChanged += PersistencePropertyBoundTextBox_TextChanged ;
58+ textBox . TextChanged += PropertyBoundTextBox_TextChanged ;
5859 }
5960 }
6061
62+ bindingPath = txtUserImageUrl . GetBindingExpression ( TextBox . TextProperty ) ? . ParentBinding ? . Path ? . Path ;
63+
64+ if ( bindingPath != null )
65+ {
66+ TextBoxIsValidTaskCancelSources . Add ( txtUserImageUrl , new CancellationTokenSource ( ) ) ;
67+ txtUserImageUrl . LostKeyboardFocus += UserPropertyBoundTextBox_KeyboardLostFocus ;
68+ txtUserImageUrl . TextChanged += PropertyBoundTextBox_TextChanged ;
69+ }
70+
6171 Loaded += OptionsPage_Loaded ;
6272 }
63- private void PersistencePropertyBoundTextBox_TextChanged ( object sender , TextChangedEventArgs e )
73+ private void PropertyBoundTextBox_TextChanged ( object sender , TextChangedEventArgs e )
6474 {
6575 var textBox = ( TextBox ) sender ;
6676 var bindingPath = textBox . GetBindingExpression ( TextBox . TextProperty ) . ParentBinding . Path . Path ;
@@ -72,10 +82,15 @@ private void PersistencePropertyBoundTextBox_TextChanged(object sender, TextChan
7282 private void PersistencePropertyBoundTextBox_KeyboardLostFocus ( object sender , KeyboardFocusChangedEventArgs e )
7383 {
7484 var textBox = ( TextBox ) sender ;
75- ReEvaluateTextboxSetting ( textBox ) ;
85+ ReEvaluateTextboxSetting ( textBox , TeamCodingPackage . Current . Settings . SharedSettings ) ;
86+ }
87+ private void UserPropertyBoundTextBox_KeyboardLostFocus ( object sender , KeyboardFocusChangedEventArgs e )
88+ {
89+ var textBox = ( TextBox ) sender ;
90+ ReEvaluateTextboxSetting ( textBox , TeamCodingPackage . Current . Settings . UserSettings ) ;
7691 }
7792
78- private void ReEvaluateTextboxSetting ( TextBox textBox )
93+ private void ReEvaluateTextboxSetting ( TextBox textBox , object settingsObject )
7994 {
8095 // Cancel any existing tasks to see if the new setting property is valid (since we're changing it anyway)
8196 TextBoxIsValidTaskCancelSources [ textBox ] . Cancel ( ) ;
@@ -93,7 +108,7 @@ private void ReEvaluateTextboxSetting(TextBox textBox)
93108 textBlock . Foreground = Brushes . Black ;
94109 textBlock . Text = "⏳" ;
95110 textBlock . ToolTip = "Checking configuration value..." ;
96- var settingProperty = ( SettingProperty < string > ) typeof ( SharedSettings ) . GetField ( bindingPath + "Property" ) . GetValue ( TeamCodingPackage . Current . Settings . SharedSettings ) ;
111+ var settingProperty = ( SettingProperty < string > ) settingsObject . GetType ( ) . GetField ( bindingPath + "Property" , System . Reflection . BindingFlags . NonPublic | System . Reflection . BindingFlags . Public | System . Reflection . BindingFlags . Instance ) . GetValue ( settingsObject ) ;
97112
98113 // Add a new token to the dictionary to use with this task we're about to create
99114 TextBoxIsValidTaskCancelSources [ textBox ] = new CancellationTokenSource ( ) ;
@@ -137,16 +152,26 @@ private void OptionsPage_Loaded(object sender, RoutedEventArgs e)
137152
138153 chkUsingJsonSettings . IsChecked = loadedFromFile ;
139154
155+ string bindingPath ;
156+
140157 foreach ( var textBox in grpPersistence . FindChildren < TextBox > ( ) )
141158 {
142- var bindingPath = textBox . GetBindingExpression ( TextBox . TextProperty ) ? . ParentBinding ? . Path ? . Path ;
159+ bindingPath = textBox . GetBindingExpression ( TextBox . TextProperty ) ? . ParentBinding ? . Path ? . Path ;
143160
144161 if ( bindingPath != null )
145162 {
146163 textBox . GetBindingExpression ( TextBox . TextProperty ) . UpdateTarget ( ) ;
147- ReEvaluateTextboxSetting ( textBox ) ;
164+ ReEvaluateTextboxSetting ( textBox , TeamCodingPackage . Current . Settings . SharedSettings ) ;
148165 }
149166 }
167+
168+ bindingPath = txtUserImageUrl . GetBindingExpression ( TextBox . TextProperty ) ? . ParentBinding ? . Path ? . Path ;
169+
170+ if ( bindingPath != null )
171+ {
172+ txtUserImageUrl . GetBindingExpression ( TextBox . TextProperty ) . UpdateTarget ( ) ;
173+ ReEvaluateTextboxSetting ( txtUserImageUrl , TeamCodingPackage . Current . Settings . UserSettings ) ;
174+ }
150175 }
151176 private void Control_GotKeyboardFocus ( object sender , KeyboardFocusChangedEventArgs e )
152177 {
0 commit comments