Example #1
0
 private static void Invoke(Action a)
 {
     if (sPlayer.InvokeRequired)
     {
         sPlayer.BeginInvoke(a);
     }
     else
     {
         a();
     }
 }
Example #2
0
        public override void SetVideoWindow()
        {
            if (wmpCtrl != null)
            {
                System.Action si = () =>
                {
                    wmpCtrl.Location   = new Point(FullScreen ? 0 : GUIGraphicsContext.VideoWindow.X, FullScreen ? 0 : GUIGraphicsContext.VideoWindow.Y);
                    wmpCtrl.ClientSize = new Size(FullScreen ? GUIGraphicsContext.Width : GUIGraphicsContext.VideoWindow.Width, FullScreen ? GUIGraphicsContext.Height : GUIGraphicsContext.VideoWindow.Height);
                };

                if (wmpCtrl.InvokeRequired)
                {
                    IAsyncResult iar = wmpCtrl.BeginInvoke(si);
                    iar.AsyncWaitHandle.WaitOne();
                }
                else
                {
                    si();
                }

                _videoRectangle  = new Rectangle(wmpCtrl.Location.X, wmpCtrl.Location.Y, wmpCtrl.ClientSize.Width, wmpCtrl.ClientSize.Height);
                _sourceRectangle = _videoRectangle;
            }
        }
        public override void SetVideoWindow()
        {
            if (_wmp10Player == null)
            {
                return;
            }
            if (GUIGraphicsContext.IsFullScreenVideo != _isFullScreen)
            {
                _isFullScreen = GUIGraphicsContext.IsFullScreenVideo;
                _needUpdate   = true;
            }
            if (!_needUpdate && !GUIGraphicsContext.UpdateVideoWindow)
            {
                return;
            }
            _needUpdate = false;
            GUIGraphicsContext.UpdateVideoWindow = false;

            if (_isFullScreen)
            {
                Log.Info("AudioPlayer:Fullscreen");

                _positionX   = GUIGraphicsContext.OverScanLeft;
                _positionY   = GUIGraphicsContext.OverScanTop;
                _videoWidth  = GUIGraphicsContext.OverScanWidth;
                _videoHeight = GUIGraphicsContext.OverScanHeight;

                SafeInvoke si = new SafeInvoke(delegate()
                {
                    _wmp10Player.Location   = new Point(0, 0);
                    _wmp10Player.ClientSize = new Size(GUIGraphicsContext.Width,
                                                       GUIGraphicsContext.Height);
                    _wmp10Player.Size = new Size(GUIGraphicsContext.Width,
                                                 GUIGraphicsContext.Height);
                    _wmp10Player.stretchToFit = true;
                });

                if (_wmp10Player.InvokeRequired)
                {
                    IAsyncResult iar = _wmp10Player.BeginInvoke(si);
                    iar.AsyncWaitHandle.WaitOne();
                }
                else
                {
                    si();
                }

                _videoRectangle  = new Rectangle(0, 0, _wmp10Player.ClientSize.Width, _wmp10Player.ClientSize.Height);
                _sourceRectangle = _videoRectangle;

                //_wmp10Player.fullScreen=true;
                Log.Info("AudioPlayer:done");
                return;
            }
            else
            {
                SafeInvoke si = new SafeInvoke(delegate()
                {
                    _wmp10Player.ClientSize = new Size(_videoWidth, _videoHeight);
                    _wmp10Player.Location   = new Point(_positionX, _positionY);
                });
                if (_wmp10Player.InvokeRequired)
                {
                    IAsyncResult iar = _wmp10Player.BeginInvoke(si);
                    iar.AsyncWaitHandle.WaitOne();
                }
                else
                {
                    si();
                }
                _videoRectangle = new Rectangle(_positionX, _positionY, _wmp10Player.ClientSize.Width,
                                                _wmp10Player.ClientSize.Height);
                _sourceRectangle = _videoRectangle;
                //Log.Info("AudioPlayer:set window:({0},{1})-({2},{3})",_positionX,_positionY,_positionX+_wmp10Player.ClientSize.Width,_positionY+_wmp10Player.ClientSize.Height);
            }
            //_wmp10Player.uiMode = "none";
            //_wmp10Player.windowlessVideo = true;
            //_wmp10Player.enableContextMenu = false;
            //_wmp10Player.Ctlenabled = false;
            GUIGraphicsContext.form.Controls[0].Enabled = false;
        }