//Sets main page and fixes orientation for camera
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     mainPage = (AboutYouPage)e.Parameter;
     DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
     displayRequest = new DisplayRequest();
     displayRequest.RequestActive();
 }
 protected override void OnNavigatedFrom(NavigationEventArgs e)
 {
     if (dispRequest != null)
     {
         dispRequest = null;
     }
 }
示例#3
0
        private async void OnPlaybackStateChanged(MediaPlaybackSession sender, object args)
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                switch (sender.PlaybackState)
                {
                case MediaPlaybackState.Opening:
                case MediaPlaybackState.Buffering:
                case MediaPlaybackState.Playing:
                    if (_request == null)
                    {
                        _request = new DisplayRequest();
                        _request.RequestActive();
                    }
                    break;

                default:
                    if (_request != null)
                    {
                        _request.RequestRelease();
                        _request = null;
                    }
                    break;
                }
            });
        }
        private void VideoPlayerOnCurrentStateChanged(object sender, RoutedEventArgs e)
        {
            // Check to hide the loading.
            if (_videoPlayer.CurrentState != MediaElementState.Opening)
            {
                // When we get to the state paused hide loading.
                if (_contentPanelBase.IsLoading)
                {
                    _contentPanelBase.FireOnLoading(false);
                }
            }

            // If we are playing request for the screen not to turn off.
            if (_videoPlayer.CurrentState == MediaElementState.Playing)
            {
                if (_displayRequest != null)
                {
                    return;
                }
                _displayRequest = new DisplayRequest();
                _displayRequest.RequestActive();
            }
            else
            {
                // If anything else happens and we have a current request remove it.
                if (_displayRequest == null)
                {
                    return;
                }
                _displayRequest.RequestRelease();
                _displayRequest = null;
            }
        }
        private void MediaElement_CurrentStateChanged(object sender, RoutedEventArgs e)
        {
            MediaElement mediaElement = sender as MediaElement;

            if (mediaElement != null && mediaElement.IsAudioOnly == false)
            {
                if (mediaElement.CurrentState == Windows.UI.Xaml.Media.MediaElementState.Playing)
                {
                    if (appDisplayRequest == null)
                    {
                        // This call creates an instance of the DisplayRequest object.
                        appDisplayRequest = new DisplayRequest();
                        appDisplayRequest.RequestActive();
                    }
                }
                else // CurrentState is Buffering, Closed, Opening, Paused, or Stopped.
                {
                    if (appDisplayRequest != null)
                    {
                        // Deactivate the display request and set the var to null.
                        appDisplayRequest.RequestRelease();
                        appDisplayRequest = null;
                    }
                }
            }
        }
        private void Dispose()
        {
            Element2.Reset();
            Element0.Reset();
            Element1.Reset();

            if (_surface != null)
            {
                _surface.Children.Remove(_mediaPlayerElement);
                _surface = null;
            }

            if (_mediaPlayer != null)
            {
                _mediaPlayer.SourceChanged -= OnSourceChanged;
                _mediaPlayer.PlaybackSession.PlaybackStateChanged -= OnPlaybackStateChanged;

                _mediaPlayerElement.SetMediaPlayer(null);
                //_mediaPlayerElement.AreTransportControlsEnabled = false;
                //_mediaPlayerElement.TransportControls = null;
                //_mediaPlayerElement = null;

                _mediaPlayer.Dispose();
                _mediaPlayer = null;

                OnSourceChanged();
            }

            if (_request != null)
            {
                _request.RequestRelease();
                _request = null;
            }
        }
示例#7
0
        public MainPage()
        {
            this.InitializeComponent();

            this.devices = new Dictionary <string, DeviceInformation>();

            this.deviceWatcher = DeviceInformation.CreateWatcher(DeviceClass.VideoCapture);
            this.deviceWatcher.EnumerationCompleted += DeviceWatcher_EnumerationCompleted;
            this.deviceWatcher.Added   += DeviceWatcher_Added;
            this.deviceWatcher.Removed += DeviceWatcher_Removed;
            this.deviceWatcher.Updated += DeviceWatcher_Updated;

            this.displayRequest = new DisplayRequest();

            this.buttonPlayPause.Click += ButtonPlayPause_Click;
            this.buttonSnap.Click      += ButtonSnap_Click;
            this.buttonSave.Click      += ButtonSave_Click;

            // set default max frame count
            this.maxFrameCount = 5;
            // init last image index to empty
            this.lastImageIndex = -1;

            // initialize collection for captured image frames
            this.bitmapFrames = new SoftwareBitmap[this.maxFrameCount];

            // create image xaml elements to show capture frames
            for (int i = 0; i < this.maxFrameCount; ++i)
            {
                this.stackPanelImages.Children.Add(new Image {
                    Width = 150
                });
            }
        }
示例#8
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                AppViewBackButtonVisibility.Collapsed;
            ViewModel = new MemoireMotsViewModel(e.Parameter as Exercice);
            _display  = new DisplayRequest();
            _display.RequestActive();


            ViewModel.OnFinLecture  += OnCompteAReboursLectureEnd;
            ViewModel.OnFinEcriture += OnCompteAReboursEcritureEnd;

            LaunchTutoButton.Visibility =
                (ContextAppli.ContextUtilisateur.ModeJeu.Equals(ModeOuvertureJeuEnum.ModeEval))
                    ? Visibility.Collapsed
                    : Visibility.Visible;
            CompteAReboursGrid.Visibility = Visibility.Visible;
            GridJeu.Visibility            = Visibility.Collapsed;
            ScoreGrid.Visibility          = Visibility.Collapsed;

            CreerTableau();
            MotTextBox.Visibility   = Visibility.Collapsed;
            ValidButton.Visibility  = Visibility.Collapsed;
            FinishButton.Visibility = Visibility.Collapsed;

            //si le tuto n'a pas déjà été vu, visionnage
            if (!await ViewModel.IsTutoPasse())
            {
                ((Frame)Window.Current.Content).Navigate(typeof(TutorielView), ViewModel.ExerciceEnCours);
            }

            //Lancement du compte à rebours du jeu
            Lanceur.StartCompteARebours();
        }
示例#9
0
        private async Task StartVideoAsync()
        {
            try
            {
                _mediaCapture = new MediaCapture();

                if (_mediaCapture != null)
                {
                    await _mediaCapture.InitializeAsync(new MediaCaptureInitializationSettings()
                    {
                        VideoDeviceId = _videoInputSelected.Id
                    });

                    CaptureElement.Source = _mediaCapture;
                    await _mediaCapture.StartPreviewAsync();

                    _isPreviewing   = true;
                    _displayRequest = new DisplayRequest();
                    _displayRequest.RequestActive();
                    _displayRequested = true;
                }
            }
            catch (UnauthorizedAccessException)
            {
                // This will be thrown if the user denied access to the camera in privacy settings
                Debug.WriteLine("The app was denied access to the camera");
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"MediaCapture initialization failed. {ex?.Message}");
            }
        }
示例#10
0
        public App()
        {
            InitializeComponent();
            SplashFactory = e => new Splash(e);

            // ensure unobserved task exceptions (unawaited async methods returning Task or Task<T>) are handled
            TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;

            // ensure general app exceptions are handled
            Application.Current.UnhandledException += App_UnhandledException;

            // Init HockeySDK
            if (!string.IsNullOrEmpty(ApplicationKeys.HockeyAppToken))
            {
                HockeyClient.Current.Configure(ApplicationKeys.HockeyAppToken);
            }

            // Set this in the instance constructor to prevent the creation of an unnecessary static constructor.
            _displayRequest = new DisplayRequest();

            // Initialize the Live Tile Updater.
            LiveTileUpdater = TileUpdateManager.CreateTileUpdaterForApplication();

            // Init the proximity helper to turn the screen off when it's in your pocket
            _proximityHelper = new ProximityHelper();
            _proximityHelper.EnableDisplayAutoOff(false);

            POGOLib.Official.Logging.Logger.RegisterLogOutput((level, message) =>
            {
                Debug.WriteLine($"[{DateTime.Now.ToString("HH:mm:ss")}][{level}] {message}");
            });
        }
示例#11
0
 public void ClosePLayer()
 {
     try
     {
         if (dispRequest != null)
         {
             dispRequest = null;
         }
         Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 0);
         ApplicationView.GetForCurrentView().ExitFullScreenMode();
         DisplayInformation.AutoRotationPreferences = DisplayOrientations.None;
         if (timer != null)
         {
             timer.Stop();
             timer = null;
         }
         if (timer_Date != null)
         {
             timer_Date.Stop();
             timer_Date = null;
         }
         gv_play.ItemsSource = null;
         webPlayer.NavigateToString(@"<!DOCTYPE html><html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml""><body>- -!</body></html>");
         danmu.ClearDanmu();
         DisplayInformation.AutoRotationPreferences = DisplayOrientations.None;
     }
     catch (Exception)
     {
     }
 }
示例#12
0
 public MainPage()
 {
     this.InitializeComponent();
     viewModel      = new ViewModel();
     DataContext    = viewModel;
     displayRequest = new DisplayRequest();
 }
示例#13
0
        private async void LoadButton_Click(object sender, RoutedEventArgs e)
        {
            MediaCapture   mediaCapture;
            DisplayRequest displayRequest = new DisplayRequest();

            try
            {
                mediaCapture = new MediaCapture();
                await mediaCapture.InitializeAsync();

                displayRequest.RequestActive();
                DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
            }
            catch (UnauthorizedAccessException)
            {
                // This will be thrown if the user denied access to the camera in privacy settings
                // ShowMessageToUser("The app was denied access to the camera");
                return;
            }

            try
            {
                PreviewImage.Source = mediaCapture;
                await mediaCapture.StartPreviewAsync();
            }
            catch (System.IO.FileLoadException)
            {
                // ShowMessageToUser("Something is wrong!!!");
                return;
            }
        }
        private async Task startPreviewAsync()
        {
            try
            {
                mediaCapture = new MediaCapture();
                await mediaCapture.InitializeAsync(settings);


                displayRequest = new DisplayRequest();
                displayRequest.RequestActive();
                DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
                lowLagCapture = await mediaCapture.PrepareLowLagPhotoCaptureAsync(ImageEncodingProperties.CreateUncompressed(MediaPixelFormat.Bgra8));
            }
            catch (UnauthorizedAccessException)
            {
                MainPage.ShowMessage("Unable to start");
                return;
            }

            try
            {
                previewControl.Source = mediaCapture;
                await mediaCapture.StartPreviewAsync();

                isPreviewing = true;
            }
            catch (System.IO.FileLoadException)
            {
                mediaCapture.CaptureDeviceExclusiveControlStatusChanged += MediaCapture_CaptureDeviceExclusiveControlStatusChanged;
            }
        }
        public ControlPageMaisto()
        {
            this.InitializeComponent();

            turn      = Turn.none;
            direction = Direction.none;

            accelerometer = App.accelerometer;
            bluetooth     = App.bluetooth;
            arduino       = App.arduino;

            if (accelerometer == null || bluetooth == null || arduino == null)
            {
                Frame.Navigate(typeof(MainPage));
                return;
            }

            startButton.IsEnabled      = true;
            stopButton.IsEnabled       = true;
            disconnectButton.IsEnabled = true;

            bluetooth.ConnectionLost += Bluetooth_ConnectionLost;

            keepScreenOnRequest = new DisplayRequest();
            keepScreenOnRequest.RequestActive();

            App.arduino.pinMode(FORWARD_CONTROL_PIN, PinMode.OUTPUT);
            App.arduino.pinMode(REVERSE_CONTROL_PIN, PinMode.OUTPUT);
            App.arduino.pinMode(LEFT_CONTROL_PIN, PinMode.OUTPUT);
            App.arduino.pinMode(RIGHT_CONTROL_PIN, PinMode.OUTPUT);
        }
示例#16
0
        private void btnStartStop_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (microphone.State == MicrophoneState.Started)
            {
                microphone.Stop();
            }


            if (soundIsStarted == false)
            {
                //prevent go to sleep
                drDisplayRequest = new DisplayRequest();
                drDisplayRequest.RequestActive();

                soundIsStarted = true;

                btnStartStop.Content    = "STOP";
                btnStartStop.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromArgb((byte)255, (byte)255, (byte)0, (byte)0));

                // Get audio data in 200ms chunks - optimum
                microphone.BufferDuration = TimeSpan.FromMilliseconds(200);

                // Allocate memory to hold the audio data
                intBufferDuration = microphone.GetSampleSizeInBytes(microphone.BufferDuration);
                buffer            = new byte[intBufferDuration];
                bufferPlay        = new byte[intBufferDuration];

                microphone.Start();// Start recording
            }
            else
            {
                stopSound();
            };
        }
示例#17
0
        private async Task StartWebcamAsync()
        {
            try
            {
                _displayRequest = new DisplayRequest();
                _mediaCapture   = new MediaCapture();
                await _mediaCapture.InitializeAsync();

                webcamPreview.Source = _mediaCapture;
                await _mediaCapture.StartPreviewAsync();

                buttonLaunchWebcam.Content = "Stop webcam";
                _isPreviewing = true;

                _displayRequest.RequestActive();
                DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
            }
            catch (UnauthorizedAccessException)
            {
                // This will be thrown if the user denied access to the camera in privacy settings
                System.Diagnostics.Debug.WriteLine("The app was denied access to the camera");
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("MediaCapture initialization failed. {0}", ex.Message);
            }
        }
        public static bool DisableLockScreenTimeOut()
        {
            try
            {
                if (g_DisplayRequest == null)
                {
                    // This call creates an instance of the displayRequest object
                    g_DisplayRequest = new DisplayRequest();
                }
            }
            catch (Exception ex)
            {
                //         rootPage.NotifyUser("Error Creating Display Request: " + ex.Message, NotifyType.ErrorMessage);
            }

            if (g_DisplayRequest != null)
            {
                try
                {
                    // This call activates a display-required request. If successful,
                    // the screen is guaranteed not to turn off automatically due to user inactivity.
                    g_DisplayRequest.RequestActive();
                    //         drCount += 1;
                    //             rootPage.NotifyUser("Display request activated (" + drCount + ")", NotifyType.StatusMessage);

                    return(true);
                }
                catch (Exception ex)
                {
                    //               rootPage.NotifyUser("Error: " + ex.Message, NotifyType.ErrorMessage);
                }
            }
            return(false);
        }
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Activate_Click(object sender, RoutedEventArgs e)
        {
            Error.Text = string.Empty;
            Button b = sender as Button;

            if (b != null)
            {
                try {
                    if (g_DisplayRequest == null)
                    {
                        // This call creates an instance of the displayRequest object
                        g_DisplayRequest = new DisplayRequest();
                    }
                } catch (Exception ex) {
                    rootPage.NotifyUser("Error Creating Display Request: " + ex.Message, NotifyType.ErrorMessage);
                }

                if (g_DisplayRequest != null)
                {
                    try {
                        // This call activates a display-required request. If successful,
                        // the screen is guaranteed not to turn off automatically due to user inactivity.
                        g_DisplayRequest.RequestActive();
                        drCount += 1;
                        rootPage.NotifyUser("Display request activated (" + drCount + ")", NotifyType.StatusMessage);
                    } catch (Exception ex) {
                        rootPage.NotifyUser("Error: " + ex.Message, NotifyType.ErrorMessage);
                    }
                }
            }
        }
示例#20
0
        private async void InitializeCamera()
        {
            if (_isCameraInitialized)
            {
                return;
            }
            _displayRequest = new DisplayRequest();
            try
            {
                _mediaCapture = new MediaCapture();
                await _mediaCapture.InitializeAsync();

                _imageEncodingProperties        = ImageEncodingProperties.CreateJpeg();
                _imageEncodingProperties.Width  = 800;
                _imageEncodingProperties.Height = 600;
                _captureElement.Source          = _mediaCapture;
                _displayRequest.RequestActive();
                DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
                _isCameraInitialized = true;

                if (_isCameraPreviewing)
                {
                    return;
                }
                await _mediaCapture.StartPreviewAsync();

                _isCameraPreviewing = true;
            }
            catch (Exception ex)
            {
                _isCameraInitialized = false;
                Debug.WriteLine("MediaCapture initialization failed. {0}", ex.Message);
            }
        }
示例#21
0
        public async Task StartPreviewAsync()
        {
            _mediaCapture   = new MediaCapture();
            _displayRequest = new DisplayRequest();

            try
            {
                await _mediaCapture.InitializeAsync();

                _displayRequest.RequestActive();
                DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
            }
            catch (UnauthorizedAccessException ex)
            {
                _loggingService.Warning("The app was denied access to the camera. Details: {Ex}", ex);
                await _dialogService.ShowAsync("The app was denied access to the camera.");

                return;
            }

            try
            {
                _captureElement.Source = _mediaCapture;
                await _mediaCapture.StartPreviewAsync();

                _isPreviewing = true;
            }
            catch (System.IO.FileLoadException ex)
            {
                _loggingService.Warning("The camera preview can't be displayed, because another app has exclusive access. Details: {Ex}", ex);
                await _dialogService.ShowAsync("The camera preview can't be displayed, because another app has exclusive access.");
            }
        }
示例#22
0
        private void MediaPlayerElement_CurrentStateChanged(object sender, RoutedEventArgs e)
        {
            MediaPlaybackSession playbackSession = sender as MediaPlaybackSession;

            if (playbackSession != null && playbackSession.NaturalVideoHeight != 0)
            {
                if (playbackSession.PlaybackState == MediaPlaybackState.Playing)
                {
                    if (appDisplayRequest == null)
                    {
                        // This call creates an instance of the DisplayRequest object
                        appDisplayRequest = new DisplayRequest();
                        appDisplayRequest.RequestActive();
                    }
                }
                else // PlaybackState is Buffering, None, Opening or Paused
                {
                    if (appDisplayRequest != null)
                    {
                        // Deactivate the displayr request and set the var to null
                        appDisplayRequest.RequestRelease();
                        appDisplayRequest = null;
                    }
                }
            }
        }
示例#23
0
        public static void StartDisplayRequest()
        {
            try
            {
                if (displayRequest == null)
                {
                    // This call creates an instance of the displayRequest object
                    displayRequest = new DisplayRequest();
                }
            }
            catch /*(Exception ex)*/
            {
                //rootPage.NotifyUser("Error Creating Display Request: " + ex.Message, NotifyType.ErrorMessage);
            }

            if (displayRequest != null)
            {
                try
                {
                    // This call activates a display-required request. If successful,
                    // the screen is guaranteed not to turn off automatically due to user inactivity.
                    displayRequest.RequestActive();
                    drCount += 1;
                    //rootPage.NotifyUser("Display request activated (" + drCount + ")", NotifyType.StatusMessage);
                }
                catch /*(Exception ex)*/
                {
                    //rootPage.NotifyUser("Error: " + ex.Message, NotifyType.ErrorMessage);
                }
            }
        }
示例#24
0
        //  private List<movie> movies;

        public MainPage()
        {
            this.InitializeComponent();
            TVs = TVManager.GetTVs();

            InitializeFrostedGlass(btl);
            InitializeFrostedGlass(GlassHost); //毛玻璃
            // movies = MovieManager.GetMovies();

            MediaPlayer             _mediaPlayer             = new MediaPlayer();
            MediaTimelineController _mediaTimelineController = new MediaTimelineController();

            var coreTitleBar = Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().TitleBar;
            var appTitleBar  = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TitleBar;

            appTitleBar.ButtonBackgroundColor = Colors.Transparent;                   //透明标题栏
            // coreTitleBar.ExtendViewIntoTitleBar = true;
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false; //取消标题栏

            NavigationCacheMode = NavigationCacheMode.Enabled;
            //  SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;


            var displayRequest = new DisplayRequest();

            displayRequest.RequestActive();

            // Window.Current.SetTitleBar(btl); //应用标题栏
        }
示例#25
0
        public MainPage()
        {
            this.InitializeComponent();

            // Start timer that periodically updates the diagnostics text at the bottom of the window
            activityUpdateTimer          = new DispatcherTimer();
            activityUpdateTimer.Tick    += ActivityUpdateTimer_Tick;
            activityUpdateTimer.Interval = new TimeSpan(0, 0, 0, 0, 250 /* milliseconds */);
            activityUpdateTimer.Start();

            // For convenience, save a pointer to logger module
            if (Application.Current as App != null)
            {
                logger = ((App)Application.Current).logger;
            }

            // Queue task to connect to device via BLE
            _ = Dispatcher.RunAsync(CoreDispatcherPriority.Low, DeviceConnect);

            // While we are running, don't blank out the screen or activate screen saver.
            // https://blogs.windows.com/windowsdeveloper/2016/05/24/how-to-prevent-screen-locks-in-your-uwp-apps/
            displayRequest = new DisplayRequest();
            displayRequest.RequestActive();

            // Listen for application events
            Application.Current.EnteredBackground += App_EnteredBackground;
            Application.Current.LeavingBackground += App_LeavingBackground;
            Application.Current.Suspending        += App_Suspending;
            Application.Current.Resuming          += App_Resuming;
        }
示例#26
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            url = e.Parameter as string;
            if (dispRequest == null)
            {
                // 用户观看视频,需要保持屏幕的点亮状态
                dispRequest = new DisplayRequest();
                dispRequest.RequestActive(); // 激活显示请求
            }
            DisplayInformation.AutoRotationPreferences = (DisplayOrientations)5;
            string urls = await GetDiliVideoUri(url);

            if (urls != string.Empty)
            {
                mediaElment.Source = new Uri(urls);
                // PropertySet options = new PropertySet();
                // mediaElment.Stop();
                //FFmpegMSS = FFmpegInteropMSS.CreateFFmpegInteropMSSFromUri(urls, false, true, options);
                // MediaStreamSource mss = FFmpegMSS.GetMediaStreamSource();
                //Pass MediaStreamSource to Media Element
                //mediaElment.SetMediaStreamSource(mss);
            }
            else
            {
                await new MessageDialog("读取地址失败").ShowAsync();
            }
        }
示例#27
0
 public BlankPage2()
 {
     curr                      = this;
     constants                 = new Constants();
     drequest                  = new DisplayRequest();
     dtimer                    = new DispatcherTimer();
     volumetimer               = new DispatcherTimer();
     volumeminustimer          = new DispatcherTimer();
     volumeminustimer.Tick    += volumeminustimer_Tick;
     forwardtimer              = new DispatcherTimer();
     forwardtimer.Tick        += forwardtimer_Tick;
     backwardtimer             = new DispatcherTimer();
     backwardtimer.Tick       += backwardtimer_Tick;
     volumetimer.Interval      = TimeSpan.FromSeconds(3);
     dtimer.Interval           = TimeSpan.FromMilliseconds(200);
     volumeminustimer.Interval = TimeSpan.FromSeconds(3);
     forwardtimer.Interval     = TimeSpan.FromSeconds(3);
     backwardtimer.Interval    = TimeSpan.FromSeconds(3);
     this.InitializeComponent();
     timer        = new DispatcherTimer();
     dtimer.Tick += dtimer_Tick;
     volume.Value = 50;
     Window.Current.SizeChanged       += Current_SizeChanged;
     Window.Current.VisibilityChanged += Current_VisibilityChanged;
 }
示例#28
0
        private void LoadVipMovie(PlayerModel info)
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                DisplayInformation.AutoRotationPreferences = (DisplayOrientations)5;
                if (dispRequest == null)
                {
                    // 用户观看视频,需要保持屏幕的点亮状态
                    dispRequest = new DisplayRequest();
                    dispRequest.RequestActive(); // 激活显示请求
                }
                web.NavigateToString("");

                string playurl = "http://www.bilibili.com/html/html5player.html?cid=" + info.Mid + "&aid=" + info.Aid + "&as_wide=1&player_type=2&urlparam=module%3Dmovie&p=1&crossDomain=1&as_wide=1";
                web.Navigate(new Uri(playurl));
            }
            catch (Exception)
            {
                messShow.Show("读取错误", 3000);
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
示例#29
0
        public App()
        {
            InitializeComponent();
            SplashFactory = e => new Splash(e);

            // ensure unobserved task exceptions (unawaited async methods returning Task or Task<T>) are handled
            TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;

            // ensure general app exceptions are handled
            Application.Current.UnhandledException += App_UnhandledException;

            // Init HockeySDK
            if (!string.IsNullOrEmpty(ApplicationKeys.HockeyAppToken))
            {
                HockeyClient.Current.Configure(ApplicationKeys.HockeyAppToken);
            }

            // Set this in the instance constructor to prevent the creation of an unnecessary static constructor.
            _displayRequest = new DisplayRequest();

            // Initialize the Live Tile Updater.
            LiveTileUpdater = TileUpdateManager.CreateTileUpdaterForApplication();

            // Init the proximity helper to turn the screen off when it's in your pocket
            _proximityHelper = new Utils.Helpers.ProximityHelper();
        }
示例#30
0
        public ControlPage()
        {
            this.InitializeComponent();

            App.Telemetry.TrackPageView("RC_Car_ControlPage");

            turn      = Turn.none;
            direction = Direction.none;

            accelerometer = App.Accelerometer;
            bluetooth     = App.Bluetooth;
            arduino       = App.Arduino;

            if (accelerometer == null || bluetooth == null || arduino == null)
            {
                Frame.Navigate(typeof(MainPage));
                return;
            }

            startButton.IsEnabled      = true;
            stopButton.IsEnabled       = true;
            disconnectButton.IsEnabled = true;

            bluetooth.ConnectionLost += Bluetooth_ConnectionLost;

            keepScreenOnRequest = new DisplayRequest();
            keepScreenOnRequest.RequestActive();

            App.Arduino.pinMode(LR_DIRECTION_CONTROL_PIN, PinMode.OUTPUT);
            App.Arduino.pinMode(FB_DIRECTION_CONTROL_PIN, PinMode.OUTPUT);
            App.Arduino.pinMode(LR_MOTOR_CONTROL_PIN, PinMode.PWM);
            App.Arduino.pinMode(FB_MOTOR_CONTROL_PIN, PinMode.PWM);
        }