public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); // enable all controls EnableControls(true); // todo: determine if we're coming back from the post page. UISwitchAnonymous.SetState(false, false); UIPublicSwitch.SetState(false, false); TogglePlaceholderText( ); // prepopulate the name fields if we have them if (RockMobileUser.Instance.LoggedIn == true) { FirstName.Field.Text = RockMobileUser.Instance.Person.NickName; LastName.Field.Text = RockMobileUser.Instance.Person.LastName; Email.Field.Text = RockMobileUser.Instance.Person.Email; } // monitor for text field being edited, and keyboard show/hide notitications NSObject handle = NSNotificationCenter.DefaultCenter.AddObserver(Rock.Mobile.PlatformSpecific.iOS.UI.KeyboardAdjustManager.TextControlChangedNotification, OnTextChanged); ObserverHandles.Add(handle); KeyboardAdjustManager.Activate( ); }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); if (ExitingFullscreen == false) { // setup a notification so we know when to hide the spinner NSObject handle = NSNotificationCenter.DefaultCenter.AddObserver(new NSString("MPMoviePlayerContentPreloadDidFinishNotification"), ContentPreloadDidFinish); ObserverHandles.Add(handle); // setup a notification so we know when they enter fullscreen, cause we'll need to play the movie again handle = NSNotificationCenter.DefaultCenter.AddObserver(MPMoviePlayerController.PlaybackStateDidChangeNotification, PlaybackStateDidChange); ObserverHandles.Add(handle); handle = NSNotificationCenter.DefaultCenter.AddObserver(MPMoviePlayerController.PlaybackDidFinishNotification, PlaybackDidFinish); ObserverHandles.Add(handle); // monitor our fullscreen status so we can manage a flag and ignore ViewDidAppear/ViewDidDisappear handle = NSNotificationCenter.DefaultCenter.AddObserver(MPMoviePlayerController.WillEnterFullscreenNotification, WillEnterFullscreen); ObserverHandles.Add(handle); handle = NSNotificationCenter.DefaultCenter.AddObserver(MPMoviePlayerController.DidEnterFullscreenNotification, DidEnterFullscreen); ObserverHandles.Add(handle); handle = NSNotificationCenter.DefaultCenter.AddObserver(MPMoviePlayerController.WillExitFullscreenNotification, WillExitFullscreen); ObserverHandles.Add(handle); handle = NSNotificationCenter.DefaultCenter.AddObserver(MPMoviePlayerController.DidExitFullscreenNotification, DidExitFullscreen); ObserverHandles.Add(handle); ResultView.Hide( ); } }
public override void ViewDidDisappear(bool animated) { base.ViewDidDisappear(animated); foreach (NSObject handle in ObserverHandles) { NSNotificationCenter.DefaultCenter.RemoveObserver(handle); } ObserverHandles.Clear( ); KeyboardAdjustManager.Deactivate( ); }
public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); // only process this if we're not entering fullscreen if (EnteringFullscreen == false) { MoviePlayer.Stop( ); foreach (NSObject handle in ObserverHandles) { NSNotificationCenter.DefaultCenter.RemoveObserver(handle); } ObserverHandles.Clear( ); } }