chore: Try Catch

This commit is contained in:
tangge233
2024-10-09 00:24:47 +08:00
parent 71d915f3ef
commit 50112b70bd
@@ -30,6 +30,7 @@ Public Class MyImage
Set(value As String) Set(value As String)
If String.IsNullOrEmpty(value) Then Exit Property If String.IsNullOrEmpty(value) Then Exit Property
_SourceData = value _SourceData = value
Try
If Not value.StartsWithF("http") Then ' 本地资源直接使用 If Not value.StartsWithF("http") Then ' 本地资源直接使用
MyBase.Source = New MyBitmap(_SourceData) MyBase.Source = New MyBitmap(_SourceData)
Exit Property Exit Property
@@ -56,6 +57,9 @@ Public Class MyImage
MyBase.Source = New MyBitmap(TempFilePath) MyBase.Source = New MyBitmap(TempFilePath)
End If End If
End Sub, TaskScheduler.FromCurrentSynchronizationContext()) End Sub, TaskScheduler.FromCurrentSynchronizationContext())
Catch ex As Exception
Log(ex, "加载图片失败")
End Try
End Set End Set
End Property End Property
Public Shared Shadows ReadOnly SourceProperty As DependencyProperty = DependencyProperty.Register("Source", GetType(String), GetType(MyImage), New PropertyMetadata(New PropertyChangedCallback( Public Shared Shadows ReadOnly SourceProperty As DependencyProperty = DependencyProperty.Register("Source", GetType(String), GetType(MyImage), New PropertyMetadata(New PropertyChangedCallback(