Esempio n. 1
0
 // Erase on Shake
 public override void MotionBegan(UIEventSubtype eType, UIEvent evt)
 {
     if (eType == UIEventSubtype.MotionShake)
     {
         var alert = UIAlertController.Create(
             "Erase Canvas?",
             "This will clear the shared Realm database and erase the canvas. Are you sure you wish to proceed?",
             UIAlertControllerStyle.Alert);
         alert.AddAction(UIAlertAction.Create("Erase", UIAlertActionStyle.Destructive, action => _drawer?.ErasePaths()));
         alert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null));
         if (alert.PopoverPresentationController != null)
         {
             alert.PopoverPresentationController.SourceView = View;
         }
         PresentViewController(alert, animated: true, completionHandler: null);
         //// unlike other gesture actions, don't call View.SetNeedsDisplay but let major Realm change prompt redisplay
     }
 }
Esempio n. 2
0
 // use the back button in preference to trying to detect shake, which is not built in
 public override void OnBackPressed()
 {
     _drawer.ErasePaths();
     _canvas.Invalidate();
 }