Esempio n. 1
0
        protected override void WndProc(ref Message m)
        {
            if (isLoaded && m.Msg == Program.WindowRestoreMessage)
            {
                if (WindowsUtils.CurrentProcessID == m.WParam.ToInt32())
                {
                    trayIcon_ClickRestore(trayIcon, EventArgs.Empty);
                }

                return;
            }

            if (browser.Ready && m.Msg == NativeMethods.WM_PARENTNOTIFY && (m.WParam.ToInt32() & 0xFFFF) == NativeMethods.WM_XBUTTONDOWN)
            {
                if (videoPlayer != null && videoPlayer.Running)
                {
                    videoPlayer.Close();
                }
                else
                {
                    browser.OnMouseClickExtra(m.WParam);
                    AnalyticsFile.BrowserExtraMouseButtons.Trigger();
                }

                return;
            }

            base.WndProc(ref m);
        }
Esempio n. 2
0
        private void button_play_Click(object sender, EventArgs e)
        {
            VideoPlayer player = videoPlayerManageCtrl1.ActiveBox;

            if (player != null)
            {
                if (player.Active)
                {
                    player.Close();
                    player.Config = null;
                    player.Refresh();
                }
                else
                {
                    IVideoSourceConfig vsConfig = null;

                    TreeNode node = dataTreeView1.SelectedNode;
                    if (node != null)
                    {
                        vsConfig = VSUtil.GetRealPlayConfig(node.Tag as DataRow);
                    }

                    if (vsConfig != null)
                    {
                        player.Config = vsConfig;
                        player.Play();
                    }
                }
            }
        }
Esempio n. 3
0
 protected override void OnClosing(CancelEventArgs e)
 {
     player.AllowClose = true;
     player.Close();
     player = null;
     base.OnClosing(e);
 }
Esempio n. 4
0
        private void button_backplay_Click(object sender, EventArgs e)
        {
            VideoPlayer player = videoPlayerManageCtrl1.ActiveBox;

            if (player != null)
            {
                if (player.Active)
                {
                    player.Close();
                    player.Config = null;
                    player.Refresh();
                }
                else
                {
                    IVideoSourceConfig vsConfig = null;

                    TreeNode node = dataTreeView1.SelectedNode;
                    if (node != null)
                    {
                        vsConfig = VSUtil.GetBackPlayConfig(node.Tag as DataRow);
                        //vsConfig.StopTime = DateTime.Now;
                        //vsConfig.StartTime = vsConfig.StopTime.AddDays(-1);

                        vsConfig.StartTime = dateTimePicker_begin.Value;
                        vsConfig.StopTime  = dateTimePicker_end.Value;
                    }

                    if (vsConfig != null)
                    {
                        player.Config = vsConfig;
                        player.Play();
                    }
                }
            }
        }
Esempio n. 5
0
 private void VideoPlayer_SeparateButtonClick(object sender, RoutedEventArgs e)
 {
     if (_currentPart != null)
     {
         VideoPlayer.Close();
         App.AppViewModel.PlayVideoSeparate(_detail, _currentPart);
     }
 }
        private async void VideoPlayer_SeparateButtonClick(object sender, RoutedEventArgs e)
        {
            VideoPlayer.Close();
            App.AppViewModel.PlayVideoSeparate(_detail, _currentPartId, !_isPlayList);
            if (_isPlayList)
            {
                var dialog = new ConfirmDialog("您为一个视频开启了单独窗口播放,是否在当前页继续播放下一个视频?");
                var result = await dialog.ShowAsync();

                if (result == ContentDialogResult.Primary)
                {
                    await PlayNextVideo();
                }
            }
        }
 protected async override void OnNavigatedFrom(NavigationEventArgs e)
 {
     if (e.SourcePageType != typeof(BangumiPage))
     {
         _isCurrently = false;
     }
     if (_currentPart != null)
     {
         await _animeService.AddVideoHistoryAsync(_currentPart.aid, _currentPart.cid, _currentPart.id, VideoPlayer.CurrentProgress, _detail.season_id);
     }
     VideoPlayer.Close();
     App.AppViewModel.CurrentVideoPlayer = null;
     App.AppViewModel.CurrentPlayerType  = Models.Enums.PlayerType.None;
     App.AppViewModel.CurrentPagePanel.CheckSubReplyPage();
     Reset();
     base.OnNavigatedFrom(e);
 }
 protected async override void OnNavigatingFrom(NavigatingCancelEventArgs e)
 {
     PageContainer.Visibility = Visibility.Collapsed;
     if (videoId > 0 && _currentPartId > 0)
     {
         await _videoService.AddVideoHistoryAsync(videoId, _currentPartId, VideoPlayer.CurrentProgress);
     }
     VideoPlayer.Close();
     if (e.SourcePageType != typeof(VideoPage))
     {
         _isCurrently = false;
     }
     App.AppViewModel.CurrentVideoPlayer = null;
     App.AppViewModel.CurrentPlayerType  = Models.Enums.PlayerType.None;
     Reset();
     App.AppViewModel.CurrentPagePanel.CheckSubReplyPage();
     base.OnNavigatingFrom(e);
 }
Esempio n. 9
0
        protected override void WndProc(ref Message m)
        {
            if (isLoaded)
            {
                if (m.Msg == Program.WindowRestoreMessage)
                {
                    if (WindowsUtils.CurrentProcessID == m.WParam.ToInt32())
                    {
                        trayIcon_ClickRestore(trayIcon, EventArgs.Empty);
                    }

                    return;
                }
                else if (m.Msg == Program.SubProcessMessage)
                {
                    int processId = m.WParam.ToInt32();

                    if (WindowsUtils.IsChildProcess(processId))  // child process is checked in two places for safety
                    {
                        BrowserProcesses.Link(m.LParam.ToInt32(), processId);
                    }

                    return;
                }
            }

            if (browser.Ready && m.Msg == NativeMethods.WM_PARENTNOTIFY && (m.WParam.ToInt32() & 0xFFFF) == NativeMethods.WM_XBUTTONDOWN)
            {
                if (videoPlayer != null && videoPlayer.Running)
                {
                    videoPlayer.Close();
                }
                else
                {
                    browser.OnMouseClickExtra(m.WParam);
                    TriggerAnalyticsEvent(AnalyticsFile.Event.BrowserExtraMouseButton);
                }

                return;
            }

            base.WndProc(ref m);
        }
Esempio n. 10
0
        public void PlayVideo(string url, string username)
        {
            if (string.IsNullOrEmpty(url))
            {
                videoPlayer?.Close();
                return;
            }

            if (videoPlayer == null)
            {
                videoPlayer = new VideoPlayer(this);

                videoPlayer.ProcessExited += (sender, args) => {
                    browser.HideVideoOverlay(true);
                };
            }

            videoPlayer.Launch(url, username);
            AnalyticsFile.VideoPlays.Trigger();
        }
Esempio n. 11
0
        private void dataTreeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            VideoPlayer player = videoPlayerManageCtrl1.ActiveBox;

            if (player != null)
            {
                if (player.Active)
                {
                    player.Close();
                    player.Config = null;
                    player.Refresh();
                }
                else
                {
                    IVideoSourceConfig vsConfig = VSUtil.GetVSConfig(e.Node.Tag as DataRow);
                    if (vsConfig != null)
                    {
                        player.Config = vsConfig;
                        player.Play();
                    }
                }
            }
        }
 private void Page_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     VideoPlayer.Close();
     Window.Current.Close();
 }
 protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
 {
     VideoPlayer.Close();
     base.OnNavigatingFrom(e);
 }
Esempio n. 14
0
        public MediaControlPage()
        {
            InitializeComponent();

            ViewModel   = new MediaControlViewModel();
            DataContext = ViewModel;

            ViewModel.StopRequested += (sender, args) =>
            {
                VideoPlayer.Close();
            };

            ViewModel.RewindRequested += (sender, args) =>
            {
                VideoPlayer.Pause();

                Rewind(ViewModel.Source.Token);
            };

            ViewModel.PlayRequested += (sender, args) =>
            {
                VideoPlayer.SpeedRatio = 1;
                VideoPlayer.Play();

                if (!VideoPlayer.HasVideo && !VideoPlayer.HasAudio)
                {
                    VideoPlayer.SpeedRatio = 0;
                }
                else
                {
                    ViewModel.CanPlay = false;
                }
            };

            ViewModel.PauseRequested += (sender, args) =>
            {
                VideoPlayer.SpeedRatio = 0;
            };

            ViewModel.FastForwardRequested += (sender, args) =>
            {
                if (VideoPlayer.SpeedRatio <= 0)
                {
                    VideoPlayer.SpeedRatio = 1;
                }
                else
                {
                    VideoPlayer.SpeedRatio = VideoPlayer.SpeedRatio * 2;
                }
            };

            ViewModel.EjectRequested += (sender, args) =>
            {
                VideoPlayer.SpeedRatio = 0;
            };

            ViewModel.FullScreenRequested += (sender, args) =>
            {
            };

            ViewModel.UpdateTime += (sender, args) =>
            {
                ViewModel.PlayTime = VideoPlayer.Position;
            };
        }
Esempio n. 15
0
 public void StopVideo()
 {
     videoPlayer?.Close();
 }