Platforms to show: All Mac Windows Linux Cross-Platform

/MacOSX/Sparkle 1.1 Carbon/Sparkle Test 2
Feedback.

Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /MacOSX/Sparkle 1.1 Carbon/Sparkle Test 2
This example is the version from Tue, 29th Jun 2009.
Notes: Last modified: Tue, 29th Jun 2009
Class Window1
Inherits Window
// Controls
ControlInstance
Sub Action() Handles Event
dim f as FolderItem
dim n as new NSImageMBS // to get exception handling

f=SelectFolder

if f=nil then Return

s=new MySparkleMBS(f)

if s.Initialized then
StaticText2.text="initialized"
else
StaticText2.text="failed to load/init"
end if

Exception s as NSExceptionMBS
MsgBox s.Message
End Sub
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
s.CheckStatus

Exception s as NSExceptionMBS
MsgBox s.Message
End Sub
End ControlInstance
ControlInstance
Sub Action() Handles Event
s.CheckForUpdates CheckBox1.Value

Exception s as NSExceptionMBS
MsgBox s.Message
End Sub
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
s.CheckWithInterval val(EditField1.text)

Exception s as NSExceptionMBS
MsgBox s.Message
End Sub
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
if s.UpdateInProgress then
StaticText4.text="yes"
else
StaticText4.text="no"
end if

Exception s as NSExceptionMBS
MsgBox s.Message
End Sub
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
dim c as CFPreferencesMBS
dim o as CFObjectMBS
dim s as CFStringMBS

if me.enabled=false then return

if me.Value then
c=new CFPreferencesMBS

c.SetAppValue NewCFStringMBS("SUCheckAtStartup"),NewCFBooleanMBS(true),c.kCFPreferencesCurrentApplication

if c.AppSynchronize(c.kCFPreferencesCurrentApplication) then
MsgBox "Saved data true."
else
MsgBox "Failed to save data."
end if
else

c=new CFPreferencesMBS

c.SetAppValue NewCFStringMBS("SUCheckAtStartup"),NewCFBooleanMBS(false),c.kCFPreferencesCurrentApplication

if c.AppSynchronize(c.kCFPreferencesCurrentApplication) then
MsgBox "Saved data false."
else
MsgBox "Failed to save data."
end if

end
End Sub
Sub Open() Handles Event
dim c as CFPreferencesMBS
dim o as CFObjectMBS
dim ss as CFBooleanMBS

c=new CFPreferencesMBS

o=c.CopyAppValue(NewCFStringMBS("SUCheckAtStartup"),c.kCFPreferencesCurrentApplication)

if o isa CFBooleanMBS then
ss=CFBooleanMBS(o)

if ss<>Nil then
me.value=ss.value
else
// MsgBox "A value was returned, but it's not a boolean"

end if
else
// MsgBox "nil was returned -> No value found."

end if

me.enabled=true
End Sub
End ControlInstance

// Properties
Protected Dim s As sparkleMBS

// Event implementations
Sub Open()
// try to load from inside the bundle

dim f as FolderItem
dim n as new NSImageMBS // to get exception handling
dim d as FolderItem

f=app.ExecutableFile

d=f.Parent
if d=nil then Return

f=d.Child("Sparkle.framework")

if f=nil or f.Exists=false then Return

s=new MySparkleMBS(f)

if s.Initialized then
StaticText2.text="initialized"
else
StaticText2.text="failed to load/init"
end if

Exception s as NSExceptionMBS
MsgBox s.Message
End Sub
End Class

Class App
Inherits Application
End Class

Class MySparkleMBS
Inherits SparkleMBS
// Event implementations
Sub FoundVersion(version as string, isNew as boolean)
if isnew then
Window1.ListBox1.AddRow "Found new version "+version
else
Window1.ListBox1.AddRow "Found old version "+version
end if

End Sub
End Class


See also:




Links
MBS Realbasic Chart Plugins - Nachhilfe in Kruft