Exemple #1
0
 private void ShowEndButton()
 {
     Debug.WriteLine("click buton");
     if (_tmpNodeNum < _pathPoint.Count)
     {
         ShowPath(_tmpNodeNum, _tmpWayNum);
     }
     else
     {
         InvokeJsEnd(); //结束
         _backgroungMusic?.MediaPlayer.Pause();
         // 显示重播按钮
         VideoButtonGrid.Visibility = Visibility.Visible;
         VideoButtonGrid.ShowReplayButton();
     }
 }
Exemple #2
0
        private async void Button_Click()
        {
            VideoButtonGrid.Hide();
            await Task.Delay(700);

            VideoButtonGrid.Visibility = Visibility.Collapsed;
            if (!_hasPath)
            {
                TestGetPath();
                Debug.WriteLine("click button");
            }
            else
            {
                StartWalk();
            }
            _backgroungMusic?.MediaPlayer.Play(); //背景音乐播放
        }
Exemple #3
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            await Task.Run(async() =>
            {
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
                {
                    // 延迟两秒后把progress隐藏
                    await Task.Delay(3000);
                    ProgressRingGrid.Hide();
                    // 显示播放按钮
                    VideoButtonGrid.Visibility = Visibility.Visible;
                    VideoButtonGrid.ShowPlayButton();
                    ProgressRingGrid.Visibility = Visibility.Collapsed;
                });
            });

            // 背景音乐
            var localFolder = ApplicationData.Current.LocalFolder;

            try
            {
                var musicFile = await localFolder.GetFileAsync(_memoryViewModel.KeyNo.ToString());

                using (var stream = await musicFile.OpenAsync(FileAccessMode.Read))
                {
                    _backgroungMusic = new MediaPlayerElement
                    {
                        Source   = MediaSource.CreateFromStream(stream, "mp3"),
                        AutoPlay = true
                    };
                }
            }
            catch (FileNotFoundException)
            {
                _backgroungMusic = null;
            }
        }