-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Window2.xaml.vb
74 lines (62 loc) · 2.34 KB
/
Window2.xaml.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Imports System.ComponentModel
Imports System.Drawing.Text
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Windows.Media.Animation
Public Class Window2
Public appDirectory As String = AppDomain.CurrentDomain.BaseDirectory
<DllImport("gdi32.dll")>
Private Shared Function AddFontResource(ByVal lpFileName As String) As Integer
End Function
Private Sub Window2_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
If Preventthepointtoomanytimes2 = True Then
Hide()
Close()
Else
Preventthepointtoomanytimes2 = True
End If
Me.Width = SystemParameters.WorkArea.Width
image1.Source = New BitmapImage(New Uri("pack://application:,,,/default-img/81.ico"))
'Start()
Topmost = True
Focus()
check()
End Sub
Private Async Sub check()
Await Task.Delay(1200)
If errormsgbox = "ok" Then
image1.Source = New BitmapImage(New Uri("pack://application:,,,/default-img/1405.ico"))
w1.Text = "保存成功~"
Await Task.Delay(1000)
Preventthepointtoomanytimes = False
StartShrinkAnimation()
'Hide()
'Close()
Else
image1.Source = New BitmapImage(New Uri("pack://application:,,,/default-img/1402.ico"))
w1.Text = "保存失败!!!"
Await Task.Delay(500)
MsgBox("错误:" & errormsgbox, vbInformation, "Error!")
Await Task.Delay(1000)
Preventthepointtoomanytimes = False
StartShrinkAnimation()
'Hide()
'Close()
End If
End Sub
Private Sub StartShrinkAnimation()
Dim initialX As Double = Me.Left
Dim targetX As Double = SystemParameters.PrimaryScreenWidth
Dim animation As New DoubleAnimation()
animation.From = initialX
animation.To = targetX
animation.Duration = New Duration(TimeSpan.FromSeconds(1))
animation.EasingFunction = New QuadraticEase()
AddHandler animation.Completed, AddressOf Animation_Completed
Me.BeginAnimation(Window.LeftProperty, animation)
End Sub
Private Sub Animation_Completed(sender As Object, e As EventArgs)
Preventthepointtoomanytimes2 = False
Close()
End Sub
End Class