Vibration
Vibratecontroller. Default. Start (Timespan. Fromseconds (. 5 ));
The parameter is the vibration duration, and the maximum value is 5 seconds.Vibratecontroller. Default. Stop (); the user turns off the vibration in the settings of the mobile phone and does not affect the vibration of the app. It only affects SMS calls.
LetProgramKeep running when the phone is locked
Two global variables apply to different scenarios:
PhoneapplicationserviceAfter the. Current. applicationidledetectionmode is disabled, the monitor and lock will be turned off during the timeout period, but it will still run, such as GPS mileage applications and music playing.
PhoneapplicationserviceAfter the. Current. useridledetectionmode is disabled, the display and lock will not be turned off upon timeout, such as video applications.
After disable, you cannot enable the program in this run. You can enable the program only after it is restarted.
// Allow the app to run (and vibrate) even when the phone is locked. // once disabled, you cannot re-enable the default behavior!Phoneapplicationservice. Current. applicationidledetectionmode =Idledetectionmode. Disabled;
Batch initialize buttons
// Fill the wrap panel with the 90 buttonsFor(IntI = 0; I <This. Buttons. length; I ++ ){This. Buttons [I] =NewButton{// Each button contains a square, invisile (fill = NULL) When off and accent-colored when onContent =NewRectangle{Margin =NewThickness(0, 7, 0, 5), width = 30, Height = 30 }};This. Buttons [I]. Click + = button_click;This. Wrappanel. Children. Add (This. Buttons [I]);}
Linebreak
In XAML, <linebreak/> is used to indicate carriage return, rather than \ r \ n.