我在我的模型Public Sub LoadAnnos(ByRef annotationList As ObservableCollection(Of PdfMarkupAnnotationDataWrapper), pdfViewer As PdfViewerControl)
annotationList = XMLSerialization.Deserialize()
For Each anno In annotationList
AddAnnotationsToPdf(pdfViewer, anno)
Next
End Sub
中从我的viewmodel调用一个方法,它有一个ObservableCollection作为参数(ByRef),如下所示:
AddAnnotationsToPdf(pdfViewer, anno)
在这个方法中,我为集合赋值:
LoadAnnos
现在这个集合有一些价值,并不是什么都没有。
行AnnotationList
在我的ViewModel中触发一个事件(我称之为方法 Public Sub PdfViewerTextMarkupAnnotationCreating(ByVal sender As Object, ByVal e As PdfTextMarkupAnnotationCreatingEventArgs)
_pdfModel.AddAnnotationsToList(AnnotationList, e)
If AnnotationList IsNot Nothing Then 'AnnotationList is nothing even tough it wasn't in LoadAnnos
XMLSerialization.Serialize(AnnotationList)
End If
)。
如果我现在在这个事件中使用集合NUnit
,那就没什么了。
以下是活动:
NUnit
End Sub