/
NotificationCenter.rbbas
executable file
·116 lines (91 loc) · 2.76 KB
/
NotificationCenter.rbbas
1
#tag ClassProtected Class NotificationCenterInherits NSUserNotificationCenterDelegateMBS #tag Event Sub didActivateNotification(center as NSUserNotificationCenterMBS, notification as NSUserNotificationMBS) Select case notification.activationType case notification.NSUserNotificationActivationTypeNone // Clicked on nothing case notification.NSUserNotificationActivationTypeContentsClicked // Clicked on the content app.FrontmostMBS = True case notification.NSUserNotificationActivationTypeActionButtonClicked // Clicked on the action button app.FrontmostMBS = True end Select End Sub #tag EndEvent #tag Event Function shouldPresentNotification(center as NSUserNotificationCenterMBS, notification as NSUserNotificationMBS) As boolean Return True End Function #tag EndEvent #tag Method, Flags = &h0 Sub Message(Message as String = "") Dim n as New NSUserNotificationMBS 'n.Title = App.kAppName n.informativeText = Message Dim nc as New NSUserNotificationCenterMBS nc.deliverNotification n 'Return n 'Dim n as NSUserNotificationMBS = app.ncdelegate.Message( "Test message" ) 'App.nc.deliverNotification n End Sub #tag EndMethod #tag Method, Flags = &h0 Function Notify(Title as String = "", Subtitle as String = "", Message as String = "", btnAction as String = "", btnOther as String = "") As NSUserNotificationMBS Dim n as New NSUserNotificationMBS n.Title = Title n.subtitle = Subtitle n.informativeText = Message If Trim( btnAction ) <> "" Then n.actionButtonTitle = btnAction n.hasActionButton = True End If n.otherButtonTitle = btnOther Return n End Function #tag EndMethod #tag Property, Flags = &h0 Available As Boolean = False #tag EndProperty #tag ViewBehavior #tag ViewProperty Name="Available" Group="Behavior" InitialValue="False" Type="Boolean" #tag EndViewProperty #tag ViewProperty Name="Index" Visible=true Group="ID" InheritedFrom="NSUserNotificationCenterDelegateMBS" #tag EndViewProperty #tag ViewProperty Name="Left" Visible=true Group="Position" InheritedFrom="NSUserNotificationCenterDelegateMBS" #tag EndViewProperty #tag ViewProperty Name="Name" Visible=true Group="ID" InheritedFrom="NSUserNotificationCenterDelegateMBS" #tag EndViewProperty #tag ViewProperty Name="Super" Visible=true Group="ID" InheritedFrom="NSUserNotificationCenterDelegateMBS" #tag EndViewProperty #tag ViewProperty Name="Top" Visible=true Group="Position" InheritedFrom="NSUserNotificationCenterDelegateMBS" #tag EndViewProperty #tag EndViewBehaviorEnd Class#tag EndClass