@@ -16,6 +16,7 @@ public partial class AddControlTimerLabel : UserControl
1616 {
1717 private string currentScreen ;
1818 string sOriginalName = "" ;
19+ string sOriginalObject = "" ;
1920 string sMode = "" ;
2021
2122 public AddControlTimerLabel ( string screen , string controlName = "" )
@@ -39,8 +40,7 @@ public AddControlTimerLabel(string screen, string controlName = "")
3940 LoadCurrentScreenObject ( controlName ) ;
4041 }
4142 }
42-
43- if ( controlName == "" )
43+ else
4444 {
4545 sMode = "Add" ;
4646 }
@@ -79,9 +79,7 @@ private void LoadColors()
7979 foreColorComboBox . Text = "Black" ;
8080 backColorComboBox . Text = "White" ;
8181 txtFont . Text = "Arial" ;
82- // txtFont.FontFamily = new System.Windows.Media.FontFamily("Arial");
8382 txtSize . Text = "8.5" ;
84-
8583 }
8684
8785 private void txtFont_MouseLeftButtonUp ( object sender , System . Windows . Input . MouseButtonEventArgs e )
@@ -91,17 +89,15 @@ private void txtFont_MouseLeftButtonUp(object sender, System.Windows.Input.Mouse
9189 System . Windows . Forms . FontDialog dlgFont = null ;
9290 dlgFont = new System . Windows . Forms . FontDialog ( ) ;
9391
94-
9592 if ( dlgFont . ShowDialog ( ) == System . Windows . Forms . DialogResult . OK )
9693 {
9794 txtFont . Text = dlgFont . Font . FontFamily . Name ;
9895 txtFont . FontFamily = new System . Windows . Media . FontFamily ( dlgFont . Font . FontFamily . Name ) ;
9996 txtSize . Text = dlgFont . Font . Size . ToString ( ) ;
10097 }
10198 }
102- catch ( Exception ex )
99+ catch
103100 {
104-
105101 }
106102 }
107103
@@ -134,8 +130,10 @@ private void btnUpdate_Click(object sender, RoutedEventArgs e)
134130 OSAEObjectPropertyManager . ObjectPropertySet ( sName , "X" , txtX . Text , "GUI" ) ;
135131 OSAEObjectPropertyManager . ObjectPropertySet ( sName , "Y" , txtY . Text , "GUI" ) ;
136132 OSAEObjectPropertyManager . ObjectPropertySet ( sName , "Zorder" , "1" , "GUI" ) ;
137-
138- OSAEScreenControlManager . ScreenObjectAdd ( currentScreen , objectComboBox . Text , sName ) ;
133+ if ( ( sOriginalObject != objectComboBox . Text ) && ( sOriginalName != sName ) )
134+ {
135+ OSAEScreenControlManager . ScreenObjectUpdate ( currentScreen , objectComboBox . Text , sName ) ;
136+ }
139137 NotifyParentFinished ( ) ;
140138 }
141139
@@ -171,8 +169,11 @@ private void NotifyParentFinished()
171169 private void LoadCurrentScreenObject ( string controlName )
172170 {
173171 objectComboBox . Text = OSAEObjectPropertyManager . GetObjectPropertyValue ( controlName , "Object Name" ) . Value ;
172+ sOriginalObject = objectComboBox . Text ;
174173 txtFont . Text = OSAEObjectPropertyManager . GetObjectPropertyValue ( controlName , "Font Name" ) . Value ;
175174 txtSize . Text = OSAEObjectPropertyManager . GetObjectPropertyValue ( controlName , "Font Size" ) . Value ;
175+ foreColorComboBox . Text = OSAEObjectPropertyManager . GetObjectPropertyValue ( controlName , "Fore Color" ) . Value ;
176+ backColorComboBox . Text = OSAEObjectPropertyManager . GetObjectPropertyValue ( controlName , "Back Color" ) . Value ;
176177 txtX . Text = OSAEObjectPropertyManager . GetObjectPropertyValue ( controlName , "X" ) . Value ;
177178 txtY . Text = OSAEObjectPropertyManager . GetObjectPropertyValue ( controlName , "Y" ) . Value ;
178179 }
@@ -187,14 +188,14 @@ private void Enable_Buttons()
187188 btnDelete . IsEnabled = false ;
188189 }
189190 //Now we handle Updates with no name changes
190- if ( sMode == "Update" && sOriginalName == objectComboBox . Text )
191+ if ( sMode == "Update" && sOriginalObject == objectComboBox . Text )
191192 {
192193 btnAdd . IsEnabled = false ;
193194 btnUpdate . IsEnabled = true ;
194195 btnDelete . IsEnabled = true ;
195196 }
196197 //Now we handle Updates WITH name changes
197- if ( sMode == "Update" && sOriginalName != objectComboBox . Text )
198+ if ( sMode == "Update" && sOriginalObject != objectComboBox . Text )
198199 {
199200 btnAdd . IsEnabled = true ;
200201 btnUpdate . IsEnabled = true ;
0 commit comments