109 lines
4 KiB
VB.net
109 lines
4 KiB
VB.net
Imports System.Drawing.Drawing2D
|
|
|
|
Public NotInheritable Class SplashScreen1
|
|
Private loadingTimer As Timer
|
|
Private fadeTimer As Timer
|
|
Private fadeOpacity As Double = 0.0
|
|
Private fadeDirection As Integer = 1
|
|
|
|
Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
|
|
' تنظیم متنها بر اساس اطلاعات assembly
|
|
If My.Application.Info.Title <> "" Then
|
|
ApplicationTitle.Text = My.Application.Info.Title
|
|
Else
|
|
ApplicationTitle.Text = "Box"
|
|
End If
|
|
|
|
' تنظیم نسخه
|
|
VersionLabel.Text = String.Format("نسخه {0}.{1}.{2}",
|
|
My.Application.Info.Version.Major,
|
|
My.Application.Info.Version.Minor,
|
|
My.Application.Info.Version.Build)
|
|
|
|
' تنظیم کپیرایت
|
|
If My.Application.Info.Copyright <> "" Then
|
|
Copyright.Text = My.Application.Info.Copyright
|
|
Else
|
|
Copyright.Text = "© 2024 Box. تمامی حقوق محفوظ است."
|
|
End If
|
|
|
|
' تنظیم انیمیشن بارگذاری
|
|
SetupLoadingAnimation()
|
|
|
|
' تنظیم تایمر برای نمایش splash screen
|
|
SetupSplashTimer()
|
|
End Sub
|
|
|
|
Private Sub SetupLoadingAnimation()
|
|
' تنظیم progress bar
|
|
LoadingProgressBar.Style = ProgressBarStyle.Marquee
|
|
LoadingProgressBar.MarqueeAnimationSpeed = 30
|
|
|
|
' تنظیم تایمر برای تغییر متن بارگذاری
|
|
loadingTimer = New Timer()
|
|
loadingTimer.Interval = 2000 ' هر 2 ثانیه
|
|
AddHandler loadingTimer.Tick, AddressOf LoadingTimer_Tick
|
|
loadingTimer.Start()
|
|
End Sub
|
|
|
|
Private Sub SetupSplashTimer()
|
|
' تایمر برای بستن splash screen بعد از 4 ثانیه
|
|
Dim splashTimer As New Timer()
|
|
splashTimer.Interval = 4000
|
|
AddHandler splashTimer.Tick, Sub(sender, e)
|
|
splashTimer.Stop()
|
|
splashTimer.Dispose()
|
|
Me.Close()
|
|
End Sub
|
|
splashTimer.Start()
|
|
End Sub
|
|
|
|
Private Sub LoadingTimer_Tick(sender As Object, e As EventArgs)
|
|
Dim loadingMessages() As String = {
|
|
"در حال بارگذاری...",
|
|
"آمادهسازی رابط کاربری...",
|
|
"بارگذاری تنظیمات...",
|
|
"تقریباً آماده است..."
|
|
}
|
|
|
|
Static messageIndex As Integer = 0
|
|
LoadingLabel.Text = loadingMessages(messageIndex)
|
|
messageIndex = (messageIndex + 1) Mod loadingMessages.Length
|
|
End Sub
|
|
|
|
Protected Overrides Sub OnPaint(e As PaintEventArgs)
|
|
MyBase.OnPaint(e)
|
|
|
|
' رسم گرادیانت پسزمینه
|
|
Dim rect As New Rectangle(0, 0, Me.Width, Me.Height)
|
|
Using brush As New LinearGradientBrush(rect,
|
|
Color.FromArgb(30, 30, 30),
|
|
Color.FromArgb(50, 50, 50),
|
|
45.0F)
|
|
e.Graphics.FillRectangle(brush, rect)
|
|
End Using
|
|
|
|
' رسم خط تزئینی در پایین
|
|
Using pen As New Pen(Color.FromArgb(0, 120, 215), 3)
|
|
e.Graphics.DrawLine(pen, 0, Me.Height - 3, Me.Width, Me.Height - 3)
|
|
End Using
|
|
End Sub
|
|
|
|
Private Sub CleanupTimers()
|
|
If loadingTimer IsNot Nothing Then
|
|
loadingTimer.Stop()
|
|
loadingTimer.Dispose()
|
|
loadingTimer = Nothing
|
|
End If
|
|
If fadeTimer IsNot Nothing Then
|
|
fadeTimer.Stop()
|
|
fadeTimer.Dispose()
|
|
fadeTimer = Nothing
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MainLayoutPanel_Paint(sender As Object, e As PaintEventArgs) Handles MainLayoutPanel.Paint
|
|
|
|
End Sub
|
|
End Class
|