Sub Process_Globals
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private locked As Boolean
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.Color = Colors.White
Page1.RootPanel.LoadLayout("input")
NavControl.ShowPage(Page1)
Dim no As NativeObject = Me
no.RunMethod("addListener", Null)
End Sub
Sub Application_Foreground
locked = False
End Sub
Private Sub Application_Background
Log($"locked: ${locked}"$)
End Sub
#if objc
static void displayStatusChanged(CFNotificationCenterRef center,
void *observer,
CFStringRef name,
const void *object,
CFDictionaryRef userInfo) {
if (name == CFSTR("com.apple.springboard.lockcomplete")) {
[b4i_main new]._locked = true;
}
}
- (void)addListener {
// Override point for customization after application launch.
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
NULL,
displayStatusChanged,
CFSTR("com.apple.springboard.lockcomplete"),
NULL,
CFNotificationSuspensionBehaviorDeliverImmediately);
}
#end if