Public Class Splash_Screen
	Dim Loaded As Boolean = False

	Private Sub Reddify(sender As Object, e As EventArgs) Handles CloseButton.MouseEnter
		CloseButton.BackColor = Color.Red
		CloseButton.ForeColor = Color.White
	End Sub

	Private Sub Dereddify(sender As Object, e As EventArgs) Handles CloseButton.MouseLeave
		CloseButton.BackColor = ControlColour
		CloseButton.ForeColor = Color.Black
	End Sub

	Public Sub Splash_Screen_Load(sender As Object, e As EventArgs) Handles MyBase.Load
		Icon = ProgramIcon()
		ShowSplashTimer.Start()
		If My.Settings.WorkingDirectory = "///FIRST RUN///" Then
			My.Settings.WorkingDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
			My.Settings.Save()
		End If
		If Environment.GetCommandLineArgs().Length <> 1 Then
			For i = 1 To Environment.GetCommandLineArgs().Count - 1
				If Environment.GetCommandLineArgs(i).Contains("\") Then FileToOpen = Environment.GetCommandLineArgs(i)
			Next
		End If
		If FileToOpen IsNot Nothing And FileToOpen <> "" Then
			'MsgBox(FileToOpen)
			Open_Passed_File.Show()
			ShowSplashTimer.Stop()
			Hide()
			Opacity = 1
			LoadStatus.Text = "Reading file list..."
			ShowInTaskbar = False
		Else
			If My.Computer.FileSystem.DirectoryExists(My.Settings.WorkingDirectory) Then
				LoadStatus.Text = "Reading file list..."
				Loaded = True
				NPUWindow.Show()
			Else
				MsgBox("Your working directory is unavailable! Press OK to select a new working directory. For reference, your working directory is currently set as" & vbNewLine & My.Settings.WorkingDirectory & ".")
				FolderPicker.SelectedPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments
				FolderPicker.ShowDialog()
				My.Settings.WorkingDirectory = FolderPicker.SelectedPath
				If My.Settings.WorkingDirectory = "" Then MsgBox("Don't play me like this")
				My.Settings.Save()
				LoadStatus.Text = "Loading..."
				Splash_Screen_Load(sender, e)
			End If
		End If

	End Sub

	Private Sub ShowSplashTimer_Tick(sender As Object, e As EventArgs) Handles ShowSplashTimer.Tick
		'If Not Loaded Then Opacity = 1
		'Disabled since it's not currently needed
		ShowSplashTimer.Stop()
	End Sub

	Private Sub CloseButton_Click(sender As Object, e As EventArgs) Handles CloseButton.Click
		'NPUWindow.Show()
		End
	End Sub

End Class