mono touch中app进入后台和被唤醒时的监听事件

时间:2014-02-18 00:55:31   收藏:0   阅读:534
//当前app被唤醒
            NSNotificationCenter.DefaultCenter.AddObserver (UIApplication.DidBecomeActiveNotification,(notity)=>{
                if (moviePlayerCtrl != null) {
                    //btnPlay.ReloadInputViews();
                    //btnPlay.SetNeedsDisplay();
                    string _url = CurrentCourseTag < 0 ? CourseWebUrl: RelationCourse [CurrentCourseTag, 1];
                    ResetPlayerElement (_url);
                }
            });
            //当前app进入后台
            NSNotificationCenter.DefaultCenter.AddObserver (UIApplication.DidEnterBackgroundNotification,(notity)=>{
                if (moviePlayerCtrl != null) {
                    moviePlayerCtrl.Pause ();
                    if (CCTimer != null) {
                        CCTimer.Invalidate ();
                        CCTimer.Dispose ();
                        CCTimer = null;
                    }
                    PlayerCenter.SetLocalPlaybackProEnd (CourseNumber, CT);
                }
            });

原文:http://blog.csdn.net/joyhen/article/details/19325057

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!