-
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
44 additions
and
48 deletions.
There are no files selected for viewing
34 changes: 18 additions & 16 deletions
34
...Craft Launcher 2/Controls/MyImage.xaml.vb → Plain Craft Launcher 2/Controls/MyImage.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
Public Class MyImage | ||
Inherits Image | ||
|
||
'事件 | ||
|
||
'自定义属性 | ||
Public Uuid As Integer = GetUuid() | ||
Private _Uri As String = "" | ||
|
||
Public Property Source As String | ||
Private _SourceData As String = "" | ||
|
||
''' <summary> | ||
''' 重写Image的Source属性 | ||
''' </summary> | ||
Public Shadows Property Source As String | ||
Get | ||
Return _Uri | ||
Return _SourceData | ||
End Get | ||
Set(value As String) | ||
_Uri = value | ||
RefreshImage() | ||
SetImage(value) | ||
End Set | ||
End Property '显示文本 | ||
Public Shared ReadOnly SourceProperty As DependencyProperty = DependencyProperty.Register("Source", GetType(String), GetType(MyImage), New PropertyMetadata(New PropertyChangedCallback( | ||
End Property | ||
Public Shared Shadows ReadOnly SourceProperty As DependencyProperty = DependencyProperty.Register("Source", GetType(String), GetType(MyImage), New PropertyMetadata(New PropertyChangedCallback( | ||
Sub(sender As DependencyObject, e As DependencyPropertyChangedEventArgs) | ||
If Not IsNothing(sender) Then | ||
CType(sender, MyImage)._Uri = e.NewValue.ToString() | ||
CType(sender, MyImage).RefreshImage() | ||
CType(sender, MyImage).SetImage(e.NewValue) | ||
End If | ||
End Sub))) | ||
|
||
Public Sub RefreshImage() | ||
Private Sub SetImage(source As String) | ||
If Me Is Nothing Then Exit Sub | ||
Try | ||
PanContent.Source = New MyBitmap(_Uri.ToString()) | ||
Catch ex As Exception | ||
Log(ex, "刷新图片内容失败") | ||
End Try | ||
If String.IsNullOrEmpty(source) Then Exit Sub | ||
_SourceData = source | ||
MyBase.Source = New MyBitmap(_SourceData) | ||
End Sub | ||
End Class |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters