Exemple #1
0
        public override void Initialize(Control ownerControl, string videoFileName, EventHandler onVideoLoaded, EventHandler onVideoEnded)
        {
            if (ownerControl == null)
            {
                return;
            }

            VideoFileName = videoFileName;
            OnVideoLoaded = onVideoLoaded;
            OnVideoEnded  = onVideoEnded;

            _initialWidth     = ownerControl.Width;
            _initialHeight    = ownerControl.Height;
            _form             = new MessageHandlerWindow();
            _form.OnCopyData += OnCopyData;
            _form.Show();
            _form.Hide();
            _videoPanelHandle     = ownerControl.Handle;
            _messageHandlerHandle = _form.Handle;
            _videoFileName        = videoFileName;
            _startInfo            = new ProcessStartInfo();
            _startInfo.FileName   = GetMpcHcFileName();
            _startInfo.Arguments  = "/new /minimized /slave " + _messageHandlerHandle;
            _process = Process.Start(_startInfo);
            if (_process != null)
            {
                _process.WaitForInputIdle();
            }
            _positionTimer = new Timer {
                Interval = 100
            };
            _positionTimer.Tick += PositionTimerTick;
        }
Exemple #2
0
        protected virtual void Dispose(bool disposing)
        {
            try
            {
                if (disposing)
                {
                    // release managed resources
                    if (_positionTimer != null)
                    {
                        _positionTimer.Stop();
                        _positionTimer.Dispose();
                        _positionTimer = null;
                    }

                    if (_form != null)
                    {
                        _form.OnCopyData -= OnCopyData;
                        //_form.Dispose(); this gives an error when doing File -> Exit...
                        _form = null;
                    }

                    if (_process != null)
                    {
                        _process.Dispose();
                        _process = null;
                    }
                    _startInfo = null;
                }
                ReleaseUnmangedResources();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
        public override void Initialize(System.Windows.Forms.Control ownerControl, string videoFileName, EventHandler onVideoLoaded, EventHandler onVideoEnded)
        {
            if (ownerControl == null)
                return;

            VideoFileName = videoFileName;
            OnVideoLoaded = onVideoLoaded;
            OnVideoEnded = onVideoEnded;

            _initialWidth = ownerControl.Width;
            _initialHeight = ownerControl.Height;
            _form = new MessageHandlerWindow();
            _form.OnCopyData += OnCopyData;
            _form.Show();
            _form.Hide();
            _videoPanelHandle = ownerControl.Handle;
            _messageHandlerHandle = _form.Handle;
            _videoFileName = videoFileName;
            _startInfo = new ProcessStartInfo();
            _startInfo.FileName = GetMpcHcFileName();
            _startInfo.Arguments = "/new /minimized /slave " + _messageHandlerHandle;
            _process = Process.Start(_startInfo);
            _process.WaitForInputIdle();
            _positionTimer = new Timer();
            _positionTimer.Interval = 100;
            _positionTimer.Tick += PositionTimerTick;
        }
        protected virtual void Dispose(bool disposing)
        {
            try
            {
                if (disposing)
                {
                    // release managed resources
                    if (_positionTimer != null)
                    {
                        _positionTimer.Stop();
                        _positionTimer.Dispose();
                        _positionTimer = null;
                    }

                    if (_form != null)
                    {
                        _form.OnCopyData -= OnCopyData;
                        //_form.Dispose(); this gives an error when doing File -> Exit...
                        _form = null;
                    }

                    if (_process != null)
                    {
                        _process.Dispose();
                        _process = null;
                    }
                    _startInfo = null;
                }
                ReleaseUnmangedResources();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
        public override void Initialize(Control ownerControl, string videoFileName, EventHandler onVideoLoaded, EventHandler onVideoEnded)
        {
            if (ownerControl == null)
            {
                return;
            }

            VideoFileName = videoFileName;
            OnVideoLoaded = onVideoLoaded;
            OnVideoEnded = onVideoEnded;

            initialWidth = ownerControl.Width;
            initialHeight = ownerControl.Height;
            form = new MessageHandlerWindow();
            form.OnCopyData += OnCopyData;
            form.Show();
            form.Hide();
            videoPanelHandle = ownerControl.Handle;
            messageHandlerHandle = form.Handle;
            this.videoFileName = videoFileName;
            startInfo = new ProcessStartInfo
            {
                FileName = GetMpcHcFileName(),
                Arguments = "/new /minimized /slave " + messageHandlerHandle
            };

            process = Process.Start(startInfo);
            if (process != null)
            {
                process.WaitForInputIdle();
            }

            positionTimer = new Timer { Interval = 100 };
            positionTimer.Tick += PositionTimerTick;
        }