Platforms to show: All Mac Windows Linux Cross-Platform

/Win/Sparkle for Windows/WinSparkle Test


Required plugins for this example:

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Sparkle for Windows/WinSparkle Test

This example is the version from Mon, 5th May 2019.

Project "WinSparkle Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Close() #if TargetWin32 then if Sparkle <> nil then dim Sparkle as MyWinSparkleMBS = app.Sparkle Sparkle.Cleanup end if #endif End EventHandler
EventHandler Sub Open() InitWinSparkle End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
Sub InitWinSparkle() #if TargetWin32 dim f as FolderItem #if Target64Bit then f = FindFile("WinSparkle64.dll") #else f = FindFile("WinSparkle32.dll") #endif if WinSparkleMBS.LoadLibrary(f) then dim s as new MyWinSparkleMBS s.CompanyName = "Test Inc." s.AppName = "Test App" s.AppVersion = "1.2" s.AppCastURL = "https://www.monkeybreadsoftware.de/UpdaterTest/win.xml" log "AppCastURL: "+s.AppCastURL // for details on feed format, check: // https://github.com/vslavik/winsparkle/wiki/Appcast-Feeds s.Initialize self.Sparkle = s log "Initialized" else MsgBox "Failed to load Sparkle DLL." end if #else Return #endif End Sub
Property Shared Sparkle As Variant
End Class
Class MainWindow Inherits Window
Control LogList Inherits Listbox
ControlInstance LogList Inherits Listbox
End Control
Control CheckAutomaticCheckForUpdates Inherits CheckBox
ControlInstance CheckAutomaticCheckForUpdates Inherits CheckBox
EventHandler Sub Action() #if TargetWin32 if inited then dim Sparkle as MyWinSparkleMBS = app.Sparkle sparkle.AutomaticCheckForUpdates = CheckAutomaticCheckForUpdates.value end if #endif End EventHandler
End Control
Control CheckCanShutdown Inherits CheckBox
ControlInstance CheckCanShutdown Inherits CheckBox
EventHandler Sub Action() #if TargetWin32 then if inited then dim Sparkle as MyWinSparkleMBS = app.Sparkle sparkle.CanShutdown = CheckCanShutdown.value end if #endif End EventHandler
End Control
Control Label5 Inherits Label
ControlInstance Label5 Inherits Label
End Control
Control LastCheckTimeField Inherits Label
ControlInstance LastCheckTimeField Inherits Label
End Control
Control BevelButton1 Inherits BevelButton
ControlInstance BevelButton1 Inherits BevelButton
EventHandler Sub Action() #if TargetWin32 dim Sparkle as MyWinSparkleMBS = app.Sparkle Sparkle.CheckUpdateWithUI #endif End EventHandler
End Control
Control BevelButton2 Inherits BevelButton
ControlInstance BevelButton2 Inherits BevelButton
EventHandler Sub Action() #if TargetWin32 dim Sparkle as MyWinSparkleMBS = app.Sparkle Sparkle.CheckUpdateWithoutUI #endif End EventHandler
End Control
EventHandler Sub Open() #if TargetWin32 then dim Sparkle as MyWinSparkleMBS = app.Sparkle queryLastCheckTime CheckAutomaticCheckForUpdates.value = sparkle.AutomaticCheckForUpdates Inited = true #endif End EventHandler
Sub queryLastCheckTime() #if TargetWin32 dim Sparkle as MyWinSparkleMBS = app.Sparkle dim n as integer = sparkle.LastCheckTime if n = -1 then LastCheckTimeField.Text = "n/a" else dim d as new Date(1970,1,1,0,0,0) d.TotalSeconds = d.TotalSeconds + n LastCheckTimeField.Text = d.AbbreviatedDate+" "+d.ShortTime end if #endif End Sub
Property Inited As Boolean
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyWinSparkleMBS Inherits WinSparkleMBS
EventHandler Sub DidFindUpdate() log "Did find update" End EventHandler
EventHandler Sub DidNotFindUpdate() log "Did not find update" End EventHandler
EventHandler Sub Error() log "Error event" End EventHandler
EventHandler Sub ShutdownRequest() log "Shutdown request" quit End EventHandler
EventHandler Sub UpdateCancelled() log "Update cancelled" End EventHandler
End Class
Module UtilModule
Sub Log(s as string) MainWindow.LogList.addrow s End Sub
End Module
End Project

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...