Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS MacOSX Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacOSX/NetFS Mount
This example is the version from Sat, 22th Jun 2018.
Project "NetFS Mount.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control iURL Inherits TextField
ControlInstance iURL Inherits TextField
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control iMountPath Inherits TextField
ControlInstance iMountPath Inherits TextField
End Control
Control Label3 Inherits Label
ControlInstance Label3 Inherits Label
End Control
Control iUserName Inherits TextField
ControlInstance iUserName Inherits TextField
End Control
Control Label4 Inherits Label
ControlInstance Label4 Inherits Label
End Control
Control iPassword Inherits TextField
ControlInstance iPassword Inherits TextField
End Control
Control Label5 Inherits Label
ControlInstance Label5 Inherits Label
End Control
Control CheckGuest Inherits CheckBox
ControlInstance CheckGuest Inherits CheckBox
End Control
Control CheckLoop Inherits CheckBox
ControlInstance CheckLoop Inherits CheckBox
End Control
Control CheckReadOnly Inherits CheckBox
ControlInstance CheckReadOnly Inherits CheckBox
End Control
Control CheckMountDir Inherits CheckBox
ControlInstance CheckMountDir Inherits CheckBox
End Control
Control MountSyncButton Inherits PushButton
ControlInstance MountSyncButton Inherits PushButton
EventHandler Sub Action()
dim m as new NetFSMountMBS
dim open_options as Dictionary = GetOpenOptions
dim mount_options as Dictionary = GetMountOptions
dim MountPoints() as string
dim r as integer = m.MountURLSync(_
iURL.text, iMountPath.text, _
iUserName.text, iPassword.text, _
open_options, mount_options, _
MountPoints)
log "MountURLSync returned "+str(r)
for each mp as string in MountPoints
log mp
next
End EventHandler
End Control
Control MountAsyncButton Inherits PushButton
ControlInstance MountAsyncButton Inherits PushButton
EventHandler Sub Action()
dim m as new myNetFSMountMBS
m.list = list
m.wheel = ProgressWheel1
m.CancelButton = CancelButton
m.MountAsyncButton = MountAsyncButton
dim open_options as Dictionary = GetOpenOptions
dim mount_options as Dictionary = GetMountOptions
dim MountPoints() as string
dim r as integer = m.MountURLASync(_
iURL.text, iMountPath.text, _
iUserName.text, iPassword.text, _
open_options, mount_options)
log "MountURLASync returned "+str(r)
if r = 0 then
mount = m
MountAsyncButton.Enabled = false
CancelButton.Enabled = true
ProgressWheel1.Visible = true
end if
End EventHandler
End Control
Control CancelButton Inherits PushButton
ControlInstance CancelButton Inherits PushButton
EventHandler Sub Action()
if mount <> nil then
List.AddRow "Cancel mount."
mount.Cancel
end if
ProgressWheel1.Visible = false
CancelButton.Enabled = false
MountAsyncButton.Enabled = true
mount = nil
End EventHandler
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control ProgressWheel1 Inherits ProgressWheel
ControlInstance ProgressWheel1 Inherits ProgressWheel
End Control
Function GetMountOptions() As Dictionary
dim d as new Dictionary
if CheckReadOnly.Value then
d.Value(NetFSMountMBS.kNetFSMountFlagsKey) = 1
end if
d.Value(NetFSMountMBS.kNetFSAllowSubMountsKey) = true
d.Value(NetFSMountMBS.kNetFSSoftMountKey) = true
if CheckMountDir.Value then
d.Value(NetFSMountMBS.kNetFSMountAtMountDirKey) = true
end if
return d
End Function
Function GetOpenOptions() As Dictionary
dim d as new Dictionary
if CheckGuest.Value then
d.Value(NetFSMountMBS.kNetFSUseGuestKey) = true
end if
if CheckLoop.Value then
d.Value(NetFSMountMBS.kNetFSAllowLoopbackKey) = true
end if
d.Value(NetFSMountMBS.kNAUIOptionKey) = NetFSMountMBS.kNAUIOptionAllowUI
return d
End Function
Sub log(s as string)
list.AddRow s
List.ScrollPosition = List.ListCount
End Sub
Property Mount As MyNetFSMountMBS
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MyNetFSMountMBS Inherits NetFSMountMBS
EventHandler Sub MountURLAsyncCompleted(status as Integer, URL as String, mountpoints() as String)
log CurrentMethodName
log "URL: "+url
log "Status: "+str(status)
for each m as string in MountPoints
log m
next
wheel.Visible = false
CancelButton.Enabled = false
MountAsyncButton.Enabled = true
End EventHandler
Sub log(s as string)
list.AddRow s
List.ScrollPosition = List.ListCount
End Sub
Property CancelButton As PushButton
Property MountAsyncButton As PushButton
Property Untitled As Integer
Property list As listbox
Property wheel As ProgressWheel
End Class
End Project
The items on this page are in the following plugins: MBS MacOSX Plugin.