/// <summary> /// This method will update this internal annotation based on this StickyNoteControl. /// </summary> /// <param name="tokens"></param> private void UpdateAnnotationWithSNC(XmlToken tokens) { // Check if we have an annotation attached. // Also we don't want to update the annotation when the data changes are actually caused by UpdateSNCWithAnnotation. if (_sncAnnotation != null && !InternalLocker.IsLocked(LockHelper.LockFlag.DataChanged)) { //fire trace event EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.UpdateAnnotationWithSNCBegin); // Now, we are going to update the annotation. Since we will get notified from the annotation store, // we don't want to update our internal annotation if the change has been made by this instance. // Here we lock the internal locker. using (LockHelper.AutoLocker locker = new LockHelper.AutoLocker(InternalLocker, LockHelper.LockFlag.AnnotationChanged)) { // Now, update the attached annotation. SNCAnnotation.UpdateAnnotation(tokens, this, _sncAnnotation); } //fire trace event EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.UpdateAnnotationWithSNCEnd); } }
/// <summary> /// This method will update this StickyNoteControl data based on the internal annotation variable. /// </summary> /// <param name="tokens">The data need to be updated</param> private void UpdateSNCWithAnnotation(XmlToken tokens) { if (_sncAnnotation != null) { //fire trace event EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.UpdateSNCWithAnnotationBegin); // Now, we are going to update this StickyNoteControl. We will get notified for the data being changed. // we don't want to update our internal annotation because for the data changes which are coming // from the annotation itself. So, we lock our internal locker. using (LockHelper.AutoLocker locker = new LockHelper.AutoLocker(InternalLocker, LockHelper.LockFlag.DataChanged)) { SNCAnnotation.UpdateStickyNoteControl(tokens, this, _sncAnnotation); } //fire trace event EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.UpdateSNCWithAnnotationEnd); } }