Пример #1
0
        public bool Close(IPlayerUserControl _owner = null)
        {
            if (_owner != null && _ExclusiveOwner != _owner)
            {
                return(false);
            }
            if (IsPlaying())
            {
                _ExclusiveAudioPlayer.Stop();
            }
            if (_ExclusiveOwner != null)
            {
                _ExclusiveOwner.OnStop();
            }
            if (IsOpened())
            {
                _ExclusiveAudioPlayer.Close();
            }
            IPlayerUserControl oldOwner = _ExclusiveOwner;

            _ExclusiveFile  = null;
            _ExclusiveOwner = null;
            if (oldOwner != null)
            {
                oldOwner.OnClose();
            }
            return(true);
        }
Пример #2
0
        //=========================================================================================
        // Events
        //

        //---------------------------------------------------------------------------------------
        public static bool ButtonPlayPause_Click(PlayerBase _player, IPlayerUserControl _itf, bool _allowOpen)
        {
            if (_player.File == null)
            {
                if (!_allowOpen)
                {
                    return(false);
                }
                _player.File = Manager.Instance.BrowseMusicFile();
            }
            if (_player.File == null)
            {
                return(false);
            }

            if (Manager.Instance.OpenedBy() != _itf)
            {
                if (!Manager.Instance.canOpen(_itf, _player.File))
                {
                    return(false);
                }
                Manager.Instance.Open(_itf, _player.File, false);
            }

            if (Manager.Instance.IsPlaying())
            {
                Manager.Instance.Pause();
            }
            else
            {
                Manager.Instance.Play();
            }
            return(true);
        }
Пример #3
0
        public void Open(IPlayerUserControl _owner, string _file, bool _autoPlay = true)
        {
            if (_ExclusiveLock)
            {
                return;
            }

            Close();
            _ExclusiveOwner = _owner;
            _ExclusiveFile  = _file;

            _ExclusiveAudioPlayer.Open(_file);
            if (_ExclusiveOwner != null)
            {
                _ExclusiveOwner.OnOpen();
            }
            if (_autoPlay && _ExclusiveAudioPlayer.bFileIsOpen)
            {
                _ExclusiveAudioPlayer.Play();
                if (_ExclusiveOwner != null)
                {
                    _ExclusiveOwner.OnPlay();
                }
            }
        }