Пример #1
0
 public Videoplayer()
 {
     this.InitializeComponent();
     myuri          = Videoproporty.GetVideoContent().Result.showapi_res_body.pagebean.myneed.video_uri;
     systemControls = SystemMediaTransportControls.GetForCurrentView();
     systemControls.ButtonPressed += SystemControls_ButtonPressed;
 }
Пример #2
0
        //关联不上啊,我的transportcontrol GG了,只有用封装好的了
        //哇,好气啊0.0,功能做不完了

        //private void SystemControls_ButtonPressed(SystemMediaTransportControls sender, SystemMediaTransportControlsButtonPressedEventArgs args)
        //{
        //    //throw new NotImplementedException();
        //    switch (args.Button)
        //    {
        //        case SystemMediaTransportControlsButton.Play:
        //            PlayMedia();
        //            break;
        //        case SystemMediaTransportControlsButton.Pause:
        //            PauseMedia();
        //            break;
        //        default:
        //            break;
        //    }
        //}

        //async void PlayMedia()
        //{
        //    await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        //    {
        //        myplayer.Play();
        //    });
        //}

        //async void PauseMedia()
        //{
        //    await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        //    {
        //        myplayer.Pause();
        //    });
        //}

        //private void myplayer_CurrentStateChanged(object sender, RoutedEventArgs e)
        //{
        //    switch (myplayer.CurrentState)
        //    {
        //        case MediaElementState.Playing:
        //            systemControls.PlaybackStatus = MediaPlaybackStatus.Playing;
        //            break;
        //        case MediaElementState.Paused:
        //            systemControls.PlaybackStatus = MediaPlaybackStatus.Paused;
        //            break;
        //        case MediaElementState.Stopped:
        //            systemControls.PlaybackStatus = MediaPlaybackStatus.Stopped;
        //            break;
        //        case MediaElementState.Closed:
        //            systemControls.PlaybackStatus = MediaPlaybackStatus.Closed;
        //            break;
        //        default:
        //            break;
        //    }
        //}

        //private string ItemToKeyHandler(object item)
        //{
        //    Item dataItem = item as Item;
        //    if (dataItem == null) return null;

        //    return dataItem.Id.ToString();
        //}

        //public static string GetRelativeScrollPosition(ListViewBase listViewBase, ListViewItemToKeyHandler itemToKeyHandler)
        //{

        //} //怎么感觉所有方法都不行0.0,一定用了假的控件

        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            mypro1.IsActive   = true;
            mypro1.Visibility = Visibility.Visible;
            jiazai.Visibility = Visibility.Visible;
            await Task.Delay(1000);

            try
            {
                await Videoproporty.Content(Examples);

                jiazai.Visibility = Visibility.Collapsed;
                mypro1.IsActive   = false;
                mypro1.Visibility = Visibility.Collapsed;
                mypro.IsActive    = true;
                mypro.Visibility  = Visibility.Visible;
                await Task.Delay(500);

                scrollviewer.ChangeView(null, 30, null);
                if (Examples.Count == 0)
                {
                    displayNoWifiDialog();
                }
            }
            catch
            {
                //先不急
            }
            delay.Visibility = Visibility.Collapsed;
            mypro.IsActive   = false;
            mypro.Visibility = Visibility.Collapsed;
        }
Пример #3
0
        //并没有发现这个有什么作用。。
        //private void scrollviewer_Loaded(object sender, RoutedEventArgs e)
        //{
        //    scrollviewer.ChangeView(null, 30, null);
        //}

        private async void scrollviewer_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
        {
            var sv = sender as ScrollViewer;

            if (!e.IsIntermediate)
            {
                if (sv.VerticalOffset == 0.0)
                {
                    IsPullRefresh = true;
                    try
                    {
                        await Videoproporty.Content(Examples2);

                        if (Examples2.Count == 0)
                        {
                            displayNoWifiDialog();
                        }
                    }
                    catch
                    {
                        //先不急
                    }
                    await Task.Delay(2000);

                    for (int i = 0; i < 5; i++)
                    {
                        if (Examples[0].create_time != Examples2[i].create_time)
                        {
                            Examples.Insert(0, Examples2[i]);
                        }
                        else
                        {
                            break;
                        }
                    }
                    sv.ChangeView(null, 30, null);
                }
                IsPullRefresh = false;
            }
        }