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

来源:互联网 发布:javascript有编译器吗 编辑:程序博客网 时间:2024/05/01 05:46
有不明白的地方欢迎入群 347636249 探讨


//当前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);
                }
            });
0 0
原创粉丝点击