MyHint.xaml.vb 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. Public Class MyHint
  2. Public Uuid As Integer = GetUuid()
  3. Private _IsWarn As Boolean = True
  4. Public Property IsWarn As Boolean
  5. Get
  6. Return _IsWarn
  7. End Get
  8. Set(value As Boolean)
  9. If _IsWarn = value Then Exit Property
  10. _IsWarn = value
  11. If _IsWarn Then
  12. BorderBrush = New MyColor("#99FF4444")
  13. Gradient1.Color = New MyColor("#88FFBBBB")
  14. Gradient2.Color = New MyColor("#88FF8888")
  15. Path.Fill = New MyColor("#BF0000")
  16. LabText.Foreground = New MyColor("#BF0000")
  17. BtnClose.Foreground = New MyColor("#BF0000")
  18. Path.Data = (New GeometryConverter).ConvertFromString("F1 M 58.5832,55.4172L 17.4169,55.4171C 15.5619,53.5621 15.5619,50.5546 17.4168,48.6996L 35.201,15.8402C 37.056,13.9852 40.0635,13.9852 41.9185,15.8402L 58.5832,48.6997C 60.4382,50.5546 60.4382,53.5622 58.5832,55.4172 Z M 34.0417,25.7292L 36.0208,41.9584L 39.9791,41.9583L 41.9583,25.7292L 34.0417,25.7292 Z M 38,44.3333C 36.2511,44.3333 34.8333,45.7511 34.8333,47.5C 34.8333,49.2489 36.2511,50.6667 38,50.6667C 39.7489,50.6667 41.1666,49.2489 41.1666,47.5C 41.1666,45.7511 39.7489,44.3333 38,44.3333 Z ")
  19. Else
  20. BorderBrush = New MyColor("#994D76FF")
  21. Gradient1.Color = New MyColor("#88B0D0FF")
  22. Gradient2.Color = New MyColor("#889EBAFF")
  23. Path.Fill = New MyColor("#0062BF")
  24. LabText.Foreground = New MyColor("#0062BF")
  25. BtnClose.Foreground = New MyColor("#0062BF")
  26. Path.Data = (New GeometryConverter).ConvertFromString("F1M38,19C48.4934,19 57,27.5066 57,38 57,48.4934 48.4934,57 38,57 27.5066,57 19,48.4934 19,38 19,27.5066 27.5066,19 38,19z M33.25,33.25L33.25,36.4167 36.4166,36.4167 36.4166,47.5 33.25,47.5 33.25,50.6667 44.3333,50.6667 44.3333,47.5 41.1666,47.5 41.1666,36.4167 41.1666,33.25 33.25,33.25z M38.7917,25.3333C37.48,25.3333 36.4167,26.3967 36.4167,27.7083 36.4167,29.02 37.48,30.0833 38.7917,30.0833 40.1033,30.0833 41.1667,29.02 41.1667,27.7083 41.1667,26.3967 40.1033,25.3333 38.7917,25.3333z")
  27. End If
  28. End Set
  29. End Property
  30. Public Property Text As String
  31. Get
  32. Return LabText.Text
  33. End Get
  34. Set(ByVal value As String)
  35. LabText.Text = value
  36. End Set
  37. End Property
  38. Public Property CanClose As Boolean
  39. Get
  40. Return BtnClose.Visibility = Visibility.Visible
  41. End Get
  42. Set(ByVal value As Boolean)
  43. BtnClose.Visibility = If(value, Visibility.Visible, Visibility.Collapsed)
  44. End Set
  45. End Property
  46. Public RelativeSetup As String = ""
  47. Private Sub MyHint_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
  48. If CanClose AndAlso Setup.Get(RelativeSetup) Then
  49. Visibility = Visibility.Collapsed
  50. End If
  51. End Sub
  52. Private Sub BtnClose_Click(sender As Object, e As EventArgs) Handles BtnClose.Click
  53. Setup.Set(RelativeSetup, True)
  54. AniDispose(Me, False)
  55. End Sub
  56. End Class
  57. Partial Public Module ModAnimation
  58. Public Sub AniDispose(Control As MyHint, RemoveFromChildren As Boolean, Optional CallBack As ParameterizedThreadStart = Nothing)
  59. If Not Control.IsHitTestVisible Then Exit Sub
  60. Control.IsHitTestVisible = False
  61. AniStart({
  62. AaScaleTransform(Control, -0.08, 200,, New AniEaseInFluent),
  63. AaOpacity(Control, -1, 200,, New AniEaseOutFluent),
  64. AaHeight(Control, -Control.ActualHeight, 150, 100, New AniEaseOutFluent),
  65. AaCode(Sub()
  66. If RemoveFromChildren Then
  67. CType(Control.Parent, Object).Children.Remove(Control)
  68. Else
  69. Control.Visibility = Visibility.Collapsed
  70. End If
  71. If CallBack IsNot Nothing Then CallBack(Control)
  72. End Sub,, True)
  73. }, "MyCard Dispose " & Control.Uuid)
  74. End Sub
  75. End Module