@@ -346,44 +346,63 @@ private void LoadControl(OSAE.OSAEObject obj)
346346 }
347347 catch ( Exception ex )
348348 {
349+ logging . AddToLog ( "Error finding object: " + ex . Message , true ) ;
349350 return ;
350351 }
351352 }
352- int dZ = Int32 . Parse ( obj . Property ( "ZOrder" ) . Value ) ;
353- stateImageControl . Location . X = Double . Parse ( obj . Property ( sStateMatch + " X" ) . Value ) ;
354- stateImageControl . Location . Y = Double . Parse ( obj . Property ( sStateMatch + " Y" ) . Value ) ;
355- canGUI . Children . Add ( stateImageControl ) ;
356- Canvas . SetLeft ( stateImageControl , stateImageControl . Location . X ) ;
357- Canvas . SetTop ( stateImageControl , stateImageControl . Location . Y ) ;
358- Canvas . SetZIndex ( stateImageControl , dZ ) ;
359- stateImages . Add ( stateImageControl ) ;
360- controlTypes . Add ( typeof ( StateImage ) ) ;
361- stateImageControl . PreviewMouseMove += new MouseEventHandler ( DragSource_PreviewMouseMove ) ;
353+ try
354+ {
355+ int dZ = Int32 . Parse ( obj . Property ( "ZOrder" ) . Value ) ;
356+ stateImageControl . Location . X = Double . Parse ( obj . Property ( sStateMatch + " X" ) . Value ) ;
357+ stateImageControl . Location . Y = Double . Parse ( obj . Property ( sStateMatch + " Y" ) . Value ) ;
358+ canGUI . Children . Add ( stateImageControl ) ;
359+ Canvas . SetLeft ( stateImageControl , stateImageControl . Location . X ) ;
360+ Canvas . SetTop ( stateImageControl , stateImageControl . Location . Y ) ;
361+ Canvas . SetZIndex ( stateImageControl , dZ ) ;
362+ stateImages . Add ( stateImageControl ) ;
363+ controlTypes . Add ( typeof ( StateImage ) ) ;
364+ stateImageControl . PreviewMouseMove += new MouseEventHandler ( DragSource_PreviewMouseMove ) ;
365+ }
366+ catch ( Exception ex )
367+ {
368+ logging . AddToLog ( "Error updating screenObject: " + ex . Message , true ) ;
369+ return ;
370+ }
362371 }
363372 #endregion
364373
365374 #region CONTROL PROPERTY LABEL
366375 else if ( obj . Type == "CONTROL PROPERTY LABEL" )
367376 {
368377 logging . AddToLog ( "Loading PropertyLabelControl: " + obj . Name , false ) ;
369- PropertyLabel pl = new PropertyLabel ( obj ) ;
370- canGUI . Children . Add ( pl ) ;
371- int dZ = Int32 . Parse ( obj . Property ( "ZOrder" ) . Value ) ;
372- pl . Location . X = Double . Parse ( obj . Property ( "X" ) . Value ) ;
373- pl . Location . Y = Double . Parse ( obj . Property ( "Y" ) . Value ) ;
374- Canvas . SetLeft ( pl , pl . Location . X ) ;
375- Canvas . SetTop ( pl , pl . Location . Y ) ;
376- Canvas . SetZIndex ( pl , dZ ) ;
377- propLabels . Add ( pl ) ;
378- controlTypes . Add ( typeof ( PropertyLabel ) ) ;
379- pl . PreviewMouseMove += new MouseEventHandler ( DragSource_PreviewMouseMove ) ;
378+ try
379+ {
380+ PropertyLabel pl = new PropertyLabel ( obj ) ;
381+ canGUI . Children . Add ( pl ) ;
382+ int dZ = Int32 . Parse ( obj . Property ( "ZOrder" ) . Value ) ;
383+ pl . Location . X = Double . Parse ( obj . Property ( "X" ) . Value ) ;
384+ pl . Location . Y = Double . Parse ( obj . Property ( "Y" ) . Value ) ;
385+ Canvas . SetLeft ( pl , pl . Location . X ) ;
386+ Canvas . SetTop ( pl , pl . Location . Y ) ;
387+ Canvas . SetZIndex ( pl , dZ ) ;
388+ propLabels . Add ( pl ) ;
389+ controlTypes . Add ( typeof ( PropertyLabel ) ) ;
390+ pl . PreviewMouseMove += new MouseEventHandler ( DragSource_PreviewMouseMove ) ;
391+ }
392+ catch ( Exception ex )
393+ {
394+ logging . AddToLog ( "Error updating PropertyLabelControl: " + ex . Message , true ) ;
395+ return ;
396+ }
380397 }
381398 #endregion
382399
383400 #region CONTROL STATIC LABEL
384401 else if ( obj . Type == "CONTROL STATIC LABEL" )
385402 {
386403 logging . AddToLog ( "Loading PropertyLabelControl: " + obj . Name , false ) ;
404+ try
405+ {
387406 OSAE . UI . Controls . StaticLabel sl = new OSAE . UI . Controls . StaticLabel ( obj ) ;
388407 canGUI . Children . Add ( sl ) ;
389408 int dZ = Int32 . Parse ( obj . Property ( "ZOrder" ) . Value ) ;
@@ -395,25 +414,39 @@ private void LoadControl(OSAE.OSAEObject obj)
395414 staticLabels . Add ( sl ) ;
396415 controlTypes . Add ( typeof ( OSAE . UI . Controls . StaticLabel ) ) ;
397416 sl . PreviewMouseMove += new MouseEventHandler ( DragSource_PreviewMouseMove ) ;
417+ }
418+ catch ( Exception ex )
419+ {
420+ logging . AddToLog ( "Error updating PropertyLabelControl: " + ex . Message , true ) ;
421+ return ;
422+ }
398423 }
399424 #endregion
400425
401426 #region CONTROL TIMER LABEL
402427 else if ( obj . Type == "CONTROL TIMER LABEL" )
403428 {
404- logging . AddToLog ( "Loading PropertyLabelControl: " + obj . Name , false ) ;
405- OSAE . UI . Controls . TimerLabel tl = new OSAE . UI . Controls . TimerLabel ( obj ) ;
406- canGUI . Children . Add ( tl ) ;
407- int dZ = Int32 . Parse ( obj . Property ( "ZOrder" ) . Value ) ;
408- tl . Location . X = Double . Parse ( obj . Property ( "X" ) . Value ) ;
409- tl . Location . Y = Double . Parse ( obj . Property ( "Y" ) . Value ) ;
410- Canvas . SetLeft ( tl , tl . Location . X ) ;
411- Canvas . SetTop ( tl , tl . Location . Y ) ;
412- Canvas . SetZIndex ( tl , dZ ) ;
413- timerLabels . Add ( tl ) ;
414- controlTypes . Add ( typeof ( OSAE . UI . Controls . TimerLabel ) ) ;
415- tl . PreviewMouseMove += new MouseEventHandler ( DragSource_PreviewMouseMove ) ;
429+ logging . AddToLog ( "Loading PropertyTimerControl: " + obj . Name , false ) ;
430+ try
431+ {
416432
433+ OSAE . UI . Controls . TimerLabel tl = new OSAE . UI . Controls . TimerLabel ( obj ) ;
434+ canGUI . Children . Add ( tl ) ;
435+ int dZ = Int32 . Parse ( obj . Property ( "ZOrder" ) . Value ) ;
436+ tl . Location . X = Double . Parse ( obj . Property ( "X" ) . Value ) ;
437+ tl . Location . Y = Double . Parse ( obj . Property ( "Y" ) . Value ) ;
438+ Canvas . SetLeft ( tl , tl . Location . X ) ;
439+ Canvas . SetTop ( tl , tl . Location . Y ) ;
440+ Canvas . SetZIndex ( tl , dZ ) ;
441+ timerLabels . Add ( tl ) ;
442+ controlTypes . Add ( typeof ( OSAE . UI . Controls . TimerLabel ) ) ;
443+ tl . PreviewMouseMove += new MouseEventHandler ( DragSource_PreviewMouseMove ) ;
444+ }
445+ catch ( Exception ex )
446+ {
447+ logging . AddToLog ( "Error updating PropertyTimerControl: " + ex . Message , true ) ;
448+ return ;
449+ }
417450 }
418451 #endregion
419452
0 commit comments