我正在开发一个 Windows Phone 8 应用程序,它从设备库中获取所有图片并将它们显示在列表框中。但是当我运行它时,有时会弹出一个错误,上面写着:Microsoft.Xna.Framework.ni.dll 中发生了“System.InvalidOperationException”类型的异常,但未在用户代码中处理
有什么建议吗?
我的代码是:
Dim notes As New List(Of Note)
Dim m As New MediaLibrary
Dim whatnumber As Integer = m.Pictures.Count
TextBlock2.Text = whatnumber.ToString + " IMAGES"
Dim imagesources As ImageSource()
ReDim imagesources(whatnumber)
Dim counter As Integer = 1
For Each pic In m.Pictures
imagesources(counter) = PictureDecoder.DecodeJpeg(pic.GetThumbnail)
notes.Add(New Note With {.ImageName = imagesources(counter), .Title = counter.ToString})
counter = counter + 1
Next
ListBox1.ItemsSource = notes