Пример #1
0
        public void RedockVideoControlsToolStripMenuItemClick(object sender, EventArgs e)
        {
            if (!Configuration.Settings.General.Undocked)
                return;

            if (mediaPlayer != null)
                mediaPlayer.ShowNonFullScreenControls();

            SaveUndockedPositions();

            Configuration.Settings.General.Undocked = false;

            if (_videoControlsUnDocked != null && !_videoControlsUnDocked.IsDisposed)
            {
                var control = _videoControlsUnDocked.PanelContainer.Controls[0];
                var controlCheckBox = _videoControlsUnDocked.PanelContainer.Controls[1];
                _videoControlsUnDocked.PanelContainer.Controls.Clear();
                ReDockVideoButtons(control, controlCheckBox);
                _videoControlsUnDocked.Close();
                _videoControlsUnDocked = null;
            }

            if (_waveFormUnDocked != null && !_waveFormUnDocked.IsDisposed)
            {
                var controlWaveForm = _waveFormUnDocked.PanelContainer.Controls[0];
                var controlButtons = _waveFormUnDocked.PanelContainer.Controls[1];
                var controlTrackBar = _waveFormUnDocked.PanelContainer.Controls[2];
                _waveFormUnDocked.PanelContainer.Controls.Clear();
                ReDockWaveForm(controlWaveForm, controlButtons, controlTrackBar);
                _waveFormUnDocked.Close();
                _waveFormUnDocked = null;
            }

            if (_videoPlayerUnDocked != null && !_videoPlayerUnDocked.IsDisposed)
            {
                var control = _videoPlayerUnDocked.PanelContainer.Controls[0];
                _videoPlayerUnDocked.PanelContainer.Controls.Remove(control);
                ReDockVideoPlayer(control);
                _videoPlayerUnDocked.Close();
                _videoPlayerUnDocked = null;
                if (mediaPlayer != null)
                    mediaPlayer.ShowFullscreenButton = Configuration.Settings.General.VideoPlayerShowFullscreenButton;
            }

            _isVideoControlsUnDocked = false;
            _videoPlayerUnDocked = null;
            _waveFormUnDocked = null;
            _videoControlsUnDocked = null;
            ShowVideoPlayer();

            audioVisualizer.Visible = toolStripButtonToggleWaveForm.Checked;
            trackBarWaveFormPosition.Visible = toolStripButtonToggleWaveForm.Checked;
            panelWaveFormControls.Visible = toolStripButtonToggleWaveForm.Checked;
            if (!toolStripButtonToggleVideo.Checked)
                HideVideoPlayer();

            mediaPlayer.Invalidate();
            Refresh();

            undockVideoControlsToolStripMenuItem.Visible = true;
            redockVideoControlsToolStripMenuItem.Visible = false;
        }
Пример #2
0
        private void UnDockVideoPlayer()
        {
            bool firstUndock = _videoPlayerUnDocked != null && !_videoPlayerUnDocked.IsDisposed;

            _videoPlayerUnDocked = new VideoPlayerUnDocked(this, _formPositionsAndSizes, mediaPlayer);
            _formPositionsAndSizes.SetPositionAndSize(_videoPlayerUnDocked);

            if (firstUndock)
            {
                Configuration.Settings.General.UndockedVideoPosition = _videoPlayerUnDocked.Left.ToString() + ";" + _videoPlayerUnDocked.Top.ToString() + ";" + _videoPlayerUnDocked.Width + ";" + _videoPlayerUnDocked.Height;
            }

            Control control = null;
            if (splitContainer1.Panel2.Controls.Count == 0)
            {
                control = panelVideoPlayer;
                groupBoxVideo.Controls.Remove(control);
            }
            else if (splitContainer1.Panel2.Controls.Count > 0)
            {
                control = panelVideoPlayer;
                splitContainer1.Panel2.Controls.Clear();
            }
            if (control != null)
            {
                control.Top = 0;
                control.Left = 0;
                control.Width = _videoPlayerUnDocked.PanelContainer.Width;
                control.Height = _videoPlayerUnDocked.PanelContainer.Height;
                _videoPlayerUnDocked.PanelContainer.Controls.Add(control);
            }
        }