Imports MatthiWare
Imports MatthiWare.Helpers
Imports MatthiWare.UpdateDialog
Public Class MainForm
Public updater As New UpdateDialog(Me)
Public status As UpdateStatus = UpdateStatus.None
Private Sub CheckForUpdatesToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles CheckForUpdatesToolStripMenuItem.Click
'Configure the updater first!
ConfigureUpdater()
'Set the status to updating
status = UpdateStatus.Updating
StatusToolStripStatusLabel.Text = "Checking for updates.."
'Choose wich one you want: Checking with custom properties or check and update in silent mode
updater.StartChecking() 'change this to updater.SilentUpdate() if you want silent mode
'updater.SilentUpdate()
End Sub
Private Sub ConfigureUpdater()
'Make sure he's not updating
If Not status = UpdateStatus.Updating Then
'Create a new updater
updater = New UpdateDialog(Me)
'Add event handlers
AddHandler updater.Error, AddressOf onError
AddHandler updater.latestVersion, AddressOf onLatest
AddHandler updater.newerVersion, AddressOf onNewer
'Set properties
updater.ShowErrorMessages = True
updater.ShowOnUpdate = True
updater.ShowSpecialMessage = False
updater.Language = DisplayLanguage.English
updater.DownloadServerPath = "https://www.dropbox.com/home/gamedownloadeasy/" 'set the download server
updater.ConfigFile = "update.XML" 'set the server configuration file must be in the server path
End If
End Sub
Private Sub onError(sender As Object, errorMessage As UpdateArgs)
status = UpdateStatus.Error
StatusToolStripStatusLabel.Text = "Failed to check for updates!"
End Sub
Private Sub onLatest(sender As Object, updateMessage As UpdateArgs)
status = UpdateStatus.Done
StatusToolStripStatusLabel.Text = "You already have the latest version!"
End Sub
Private Sub onNewer(sender As Object, updateMessage As UpdateArgs)
status = UpdateStatus.Done
StatusToolStripStatusLabel.Text = "A newer version is available!"
End Sub
#Region "NotImportant"
Private title As String = ""
Private Sub MainForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.title = Me.Text
Me.Text = String.Format("{0} v{1}", Me.title, Application.ProductVersion)
End Sub
#End Region
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
End Class