Imports System.Deployment.Application
Public Class Form1
Private Sub AboutBoxHelpMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutBoxHelpMenu.Click
On Error Resume Next
AboutBox.ShowDialog()
End Sub
Function ActiveBrowser() As WebBrowser
On Error Resume Next
ActiveBrowser = Nothing
For Each Control In TabControl.SelectedTab.Controls
If TypeOf Control Is WebBrowser Then
Return CType(Control, WebBrowser)
End If
Next
End Function
Private Sub AddTabFileMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddTabFileMenu.Click
On Error Resume Next
Dim X As New TabPage
X.Text = Me.ActiveBrowser.DocumentTitle
TabControl.TabPages.Add(X)
Dim Y As New WebBrowser
Y.Dock = DockStyle.Fill
X.Controls.Add(Y)
AddHandler Y.Navigated, AddressOf WebBrowser_Navigated
AddHandler Y.DocumentCompleted, AddressOf WebBrowser_DocumentCompleted
X.Controls.Add(Y)
Y.Navigate("http://www.warezxtreme.org")
Dim documentTitle As String = Me.ActiveBrowser.DocumentTitle
If documentTitle = String.Empty Then
Me.Text = Application.ProductName
Else
'Display the current page title in the window's title bar.
Me.Text = String.Format("{0} - {1}", _
documentTitle, _
Application.ProductName)
End If
End Sub
Private Sub AddTab_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddTab.Click
On Error Resume Next
Dim X As New TabPage
X.Text = Me.ActiveBrowser.DocumentTitle
TabControl.TabPages.Add(X)
Dim Y As New WebBrowser
Y.Dock = DockStyle.Fill
X.Controls.Add(Y)
AddHandler Y.Navigated, AddressOf WebBrowser_Navigated
AddHandler Y.DocumentCompleted, AddressOf WebBrowser_DocumentCompleted
X.Controls.Add(Y)
Y.Navigate("http://www.warezxtreme.org")
End Sub
Private Sub Back_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Back.Click
On Error Resume Next
CType(TabControl.SelectedTab.Controls.Item(0), WebBrowser).GoBack()
StatusProgressBar.Increment(1)
If StartTimer.Enabled = True Then
StatusProgressBar.Value = 0
End If
If FinishTimer.Enabled = True Then
StatusProgressBar.Value = 100
End If
End Sub
Private Sub CancelStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CancelStop.Click
On Error Resume Next
ActiveBrowser.Stop()
CType(TabControl.SelectedTab.Controls.Item(0), WebBrowser).Stop()
If StartTimer.Enabled = True Then
StatusProgressBar.Value = 0
End If
End Sub
Private Sub CheckForUpdatesHelpMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckForUpdatesHelpMenu.Click
Dim AD As ApplicationDeployment
Dim INFO As UpdateCheckInfo
AD = ApplicationDeployment.CurrentDeployment
INFO = AD.CheckForDetailedUpdate
If Not INFO.UpdateAvailable Then
MsgBox(" No Updates Available At This Current Time")
Return
End If
Dim doUpdate As Boolean = True
If INFO.IsUpdateRequired Then
MsgBox("There Is A Required Update Available. Downloading Now")
Else
If MsgBox("Update Available. Download Now?", MsgBoxStyle.YesNo) = MsgBoxResult.No Then
doUpdate = False
End If
If doUpdate Then
AD.Update()
MsgBox("The Updates Have Been Installed. Restarting WarezXtremE Web Browser Now")
Application.Restart()
End If
End If
End Sub
Private Sub CheckWindowsVersionHelpMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckWindowsVersionHelpMenu.Click
On Error Resume Next
Dim osVersion As String
osVersion = My.Computer.Info.OSVersion
Dim osPlatform As String
Dim osName As String
osName = My.Computer.Info.OSFullName
osPlatform = My.Computer.Info.OSPlatform
MsgBox("Operating System:" & vbCr & osName & vbCr & vbCr & "Build Version:" & vbCr & osVersion & vbCr & vbCr & "OS Platform:" & vbCr & osPlatform)
End Sub
Private Sub ClockTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClockTimer.Tick
On Error Resume Next
Dim UpdateClock As String
UpdateClock = My.Computer.Clock.LocalTime
ClockLabel.Text = System.DateTime.Now
End Sub
Private Sub CloseTab_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseTab.Click
On Error Resume Next
TabControl.TabPages.Remove(TabControl.SelectedTab)
End Sub
Private Sub CloseTabFileMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseTabFileMenu.Click
On Error Resume Next
TabControl.TabPages.Remove(TabControl.SelectedTab)
End Sub
Private Sub DisplayPageTitle()
On Error Resume Next
Dim documentTitle As String = Me.ActiveBrowser.DocumentTitle
If documentTitle = String.Empty Then
Me.Text = Application.ProductName
Else
'Display the current page title in the window's title bar.
Me.Text = String.Format("{0} - {1}", _
documentTitle, _
Application.ProductName)
End If
End Sub
Private Sub ExitFileMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitFileMenu.Click
On Error Resume Next
Application.Exit()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser.ScriptErrorsSuppressed = True
End Sub
Private Sub Forward_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Forward.Click
On Error Resume Next
CType(TabControl.SelectedTab.Controls.Item(0), WebBrowser).GoForward()
StatusProgressBar.Increment(1)
If StartTimer.Enabled = True Then
StatusProgressBar.Value = 0
End If
If FinishTimer.Enabled = True Then
StatusProgressBar.Value = 100
End If
End Sub
Private Sub Go_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Go.Click
On Error Resume Next
For Each Target As Control In TabControl.Controls
If TypeOf (Target) Is WebBrowser Then
CType(Target, WebBrowser).Navigate(URLComboBox.Text)
CType(Target, WebBrowser).WebBrowserShortcutsEnabled = True
Exit For
End If
ActiveBrowser.Navigate(URLComboBox.Text)
Next
StatusProgressBar.Increment(1)
If StartTimer.Enabled = True Then
StatusProgressBar.Value = 0
End If
If FinishTimer.Enabled = True Then
StatusProgressBar.Value = 100
End If
End Sub
Private Sub Home_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Home.Click
On Error Resume Next
ActiveBrowser.GoHome()
ActiveBrowser.Navigate("http://www.warezxtreme.org")
StatusProgressBar.Increment(1)
If StartTimer.Enabled = True Then
StatusProgressBar.Value = 0
End If
If FinishTimer.Enabled = True Then
StatusProgressBar.Value = 100
End If
End Sub
Private Function IsPopupWindow() As Boolean
On Error Resume Next
If ActiveBrowser.Document.ActiveElement.TagName = "BODY" Or WebBrowser.Document.ActiveElement.TagName = "IFRAME" Then
IsPopupWindow = True
Else
IsPopupWindow = False
End If
End Function
Private Sub Navigate(ByVal address As String)
If String.IsNullOrEmpty(address) Then Return
If address.Equals("about:blank") Then Return
If Not address.StartsWith("http://") And _
Not address.StartsWith("https://") Then
address = "http://" & address
End If
Try
ActiveBrowser.Navigate(New Uri(address))
Catch ex As System.UriFormatException
Return
End Try
StatusProgressBar.Increment(1)
If StartTimer.Enabled = True Then
StatusProgressBar.Value = 0
End If
If FinishTimer.Enabled = True Then
StatusProgressBar.Value = 100
End If
End Sub
Private Sub RandomPasswordGeneratorToolMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RandomPasswordGeneratorToolMenu.Click
WarezXtremE_Random_Password_Generator.ShowDialog()
End Sub
Private Sub Refresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RefreshButton.Click
On Error Resume Next
ActiveBrowser.Refresh()
CType(TabControl.SelectedTab.Controls.Item(0), WebBrowser).Refresh()
StatusProgressBar.Increment(1)
If StartTimer.Enabled = True Then
StatusProgressBar.Value = 0
End If
End Sub
Private Sub RestartFileMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RestartFileMenu.Click
On Error Resume Next
Application.Restart()
End Sub
Private Sub TabControl_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabControl.SelectedIndexChanged
On Error Resume Next
Dim CurrentBrowser As WebBrowser
CurrentBrowser = CType(sender, TabControl).SelectedTab.Controls(0)
Me.DisplayPageTitle()
Dim url As Uri = Me.ActiveBrowser.Url
If url Is Nothing Then
'There is no current address.
URLComboBox.Text = String.Empty
'The user cannot refresh a page that doesn't exist.
RefreshButton.Enabled = False
Else
'Display the current page address in the address bar.
URLComboBox.Text = url.ToString()
'Allow the user to refresh the current page.
RefreshButton.Enabled = True
End If
End Sub
Private Sub URLComboBox_KeyDown_(ByVal sender As Object, ByVal e As KeyEventArgs) Handles URLComboBox.KeyDown
On Error Resume Next
If (e.KeyCode = Keys.Enter) Then
Navigate(URLComboBox.Text)
StatusProgressBar.Increment(1)
If StartTimer.Enabled = True Then
StatusProgressBar.Value = 0
End If
If FinishTimer.Enabled = True Then
StatusProgressBar.Value = 100
End If
End If
End Sub
Private Sub WebBrowser_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser.DocumentCompleted
On Error Resume Next
Dim page As TabPage = TryCast((CType(sender, WebBrowser)).Parent, TabPage)
If page IsNot Nothing Then
End If
page.Text = (CType(sender, WebBrowser)).DocumentTitle
URLComboBox.Text = CType(TabControl.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString
StatusProgressBar.Increment(1)
Dim documentTitle As String = Me.ActiveBrowser.DocumentTitle
URLStatusLabel.Text = Me.ActiveBrowser.StatusText
URLStatusLabel.Text = ("Waiting for ")
If StartTimer.Enabled = True Then
StatusProgressBar.Value = 0
End If
If FinishTimer.Enabled = True Then
StatusProgressBar.Value = 100
End If
If StartTimer.Enabled = True Then
StatusProgressBar.Value = 0
End If
If documentTitle = String.Empty Then
Me.Text = Application.ProductName
Else
'Display the current page title in the window's title bar.
Me.Text = String.Format("{0} - {1}", _
documentTitle, _
Application.ProductName)
End If
ActiveBrowser.Url.ToString()
End Sub
Private Sub WebBrowser_Navigated(ByVal sender As Object, ByVal e As WebBrowserNavigatedEventArgs)
On Error Resume Next
URLComboBox.Text = ActiveBrowser.Url.ToString()
'ActiveBrowser.Navigate(URLComboBox1.Text)
'ActiveBrowser.WebBrowserShortcutsEnabled = True
StatusProgressBar.Increment(1)
If StartTimer.Enabled = True Then
StatusProgressBar.Value = 0
End If
If FinishTimer.Enabled = True Then
StatusProgressBar.Value = 100
End If
End Sub
Private Sub WebBrowser_StatusTextChanged(ByVal sender As Object, _
ByVal e As EventArgs) Handles WebBrowser.StatusTextChanged
On Error Resume Next
'Display the current page's status text in the status bar.
URLStatusLabel.Text = Me.ActiveBrowser.StatusText
Dim documentTitle As String = Me.ActiveBrowser.DocumentTitle
If documentTitle = String.Empty Then
Me.Text = Application.ProductName
Else
'Display the current page title in the window's title bar.
Me.Text = String.Format("{0} - {1}", _
documentTitle, _
Application.ProductName)
End If
End Sub
Private Sub PasteEditMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteEditMenu.Click
'If clipboard has HTML, paste it into the web browser control
If My.Computer.Clipboard.ContainsText(TextDataFormat.Html) Then
WebBrowser.DocumentText = My.Computer.Clipboard.GetText(TextDataFormat.Html)
Else
MsgBox("Clipboard does not contain any HTML", MsgBoxStyle.Exclamation And MsgBoxStyle.OkOnly)
End If
End Sub
Private Sub CopyEditMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyEditMenu.Click
'Copy HTML from web browser onto the clipboard
My.Computer.Clipboard.SetText(WebBrowser.DocumentText, TextDataFormat.Html)
End Sub
Private Sub PostGenertorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PostGenertorToolStripMenuItem.Click
End Sub
End Class