コード例 #1
0
        public void Dispatch(JukeboxCommand cmd)
        {
            var player = GetCurrentPlayer();

            if (player == null)
            {
                return;
            }

            if (cmd == JukeboxCommand.PlayAfterPaused)
            {
                if (_wasPaused)
                {
                    cmd = JukeboxCommand.Play;
                }
                else
                {
                    return;
                }
            }

            _wasPaused = (cmd == JukeboxCommand.Pause && player.IsPlaying);

            player.PerformAction(cmd);
            _lastJukebox = player;
        }
コード例 #2
0
 private void BubbleReactOnEvent(JukeboxCommand obj)
 {
     if (this.ReactOnEvent != null)
     {
         this.ReactOnEvent(obj);
     }
 }
コード例 #3
0
        public void dispatch_events_to_single_player(bool isPlaying, JukeboxCommand cmd)
        {
            itunes.SetupGet(m => m.IsPlaying).Returns(isPlaying);
            EventDispatcher dsp = new EventDispatcher(new[] { itunes.Object });

            dsp.Dispatch(cmd);

            itunes.Verify(m => m.PerformAction(cmd));
        }
コード例 #4
0
        public void dispatch_events_to_single_player(bool isPlaying, JukeboxCommand cmd)
        {
            itunes.SetupGet(m => m.IsPlaying).Returns(isPlaying);
            EventDispatcher dsp = new EventDispatcher(new[]{itunes.Object});

            dsp.Dispatch(cmd);

            itunes.Verify(m => m.PerformAction(cmd));
        }
コード例 #5
0
        public void PerformAction(JukeboxCommand cmd)
        {
            if (!_messageMapping.ContainsKey(cmd))
            {
                return;
            }

            _socket.SendMessage(_messageMapping[cmd]);
        }
コード例 #6
0
ファイル: iTunesController.cs プロジェクト: Krizzzn/shutupify
        public void PerformAction(JukeboxCommand cmd)
        {
            if (iTunes == null)
                return;
            var itunes = this.iTunes;
            if (!_actionMapping.ContainsKey(cmd))
                return;

            var methodToCall = _actionMapping[cmd];
            itunes.GetType().GetMethod(methodToCall).Invoke(itunes, new object[0]);
        }
コード例 #7
0
        public void dispatch_events_to_single_of_multiple_players(JukeboxCommand cmd)
        {
            itunes.SetupGet(m => m.IsPlaying).Returns(false);
            superplayer.SetupGet(m => m.IsPlaying).Returns(false);
            spotify.SetupGet(m => m.IsPlaying).Returns(true);
            EventDispatcher dsp = new EventDispatcher(new[] { itunes.Object, spotify.Object, superplayer.Object });

            dsp.Dispatch(cmd);

            superplayer.Verify(m => m.PerformAction(cmd), Times.Never());
            itunes.Verify(m => m.PerformAction(cmd), Times.Never());
            spotify.Verify(m => m.PerformAction(cmd), Times.Once());
        }
コード例 #8
0
        public void dispatch_events_to_single_of_multiple_players(JukeboxCommand cmd)
        {
            itunes.SetupGet(m => m.IsPlaying).Returns(false);
            superplayer.SetupGet(m => m.IsPlaying).Returns(false);
            spotify.SetupGet(m => m.IsPlaying).Returns(true);
            EventDispatcher dsp = new EventDispatcher(new[] { itunes.Object, spotify.Object, superplayer.Object });

            dsp.Dispatch(cmd);

            superplayer.Verify(m => m.PerformAction(cmd), Times.Never());
            itunes.Verify(m => m.PerformAction(cmd), Times.Never());
            spotify.Verify(m => m.PerformAction(cmd), Times.Once());
        }
コード例 #9
0
        public void PerformAction(JukeboxCommand cmd)
        {
            if (_remote == null)
            {
                return;
            }

            if (!_actionMapping.ContainsKey(cmd))
            {
                return;
            }

            var methodToCall = _actionMapping[cmd];

            _remote.GetType().GetMethod(methodToCall).Invoke(_remote, new object[0]);
        }
コード例 #10
0
        public void PerformAction(JukeboxCommand cmd)
        {
            if (iTunes == null)
            {
                return;
            }
            var itunes = this.iTunes;

            if (!_actionMapping.ContainsKey(cmd))
            {
                return;
            }

            var methodToCall = _actionMapping[cmd];

            itunes.GetType().GetMethod(methodToCall).Invoke(itunes, new object[0]);
        }
コード例 #11
0
ファイル: EventDispatcher.cs プロジェクト: Krizzzn/shutupify
        public void Dispatch(JukeboxCommand cmd)
        {
            var player = GetCurrentPlayer();

            if (player == null)
                return;

            if (cmd == JukeboxCommand.PlayAfterPaused) {
                if (_wasPaused)
                    cmd = JukeboxCommand.Play;
                else
                    return;
            }

            _wasPaused = (cmd == JukeboxCommand.Pause && player.IsPlaying);

            player.PerformAction(cmd);
            _lastJukebox = player;
        }
コード例 #12
0
ファイル: HotkeysProbe.cs プロジェクト: PlumpMath/shutupify
        private void RegisterHotKey(string hotkeyCombination, JukeboxCommand spotifyCommand)
        {
            var k = ParseKeyString(hotkeyCombination);

            if (k == Keys.None)
            {
                return;
            }

            var hotkey = new ManagedWinapi.Hotkey();

            if (hotkey.Enabled)
            {
                hotkey.Enabled = false;
            }

            hotkey.Alt   = hotkeyCombination.Contains("ALT");
            hotkey.Ctrl  = hotkeyCombination.Contains("CTRL") || hotkeyCombination.Contains("STRG");
            hotkey.Shift = hotkeyCombination.Contains("SHIFT");

            if (!hotkey.Alt && !hotkey.Ctrl && !hotkey.Shift)
            {
                hotkey.Dispose();
                return;
            }

            hotkey.KeyCode = k;

            hotkey.HotkeyPressed += (s, e) => {
                if (ReactOnEvent != null)
                {
                    ReactOnEvent(spotifyCommand);
                }
            };
            this._hotkeys.Add(hotkey);
        }
コード例 #13
0
        public void PerformAction(JukeboxCommand cmd)
        {
            if (!_messageMapping.ContainsKey(cmd))
                return;

            _socket.SendMessage(_messageMapping[cmd]);
        }
コード例 #14
0
ファイル: MockPlugin.cs プロジェクト: Krizzzn/shutupify
 public void PerformAction(JukeboxCommand cmd)
 {
 }
コード例 #15
0
 public void PerformAction(JukeboxCommand cmd)
 {
     _actionMapping[cmd]();
 }
コード例 #16
0
 public void PerformAction(JukeboxCommand cmd)
 {
     _actionMapping[cmd]();
 }
コード例 #17
0
ファイル: VLController.cs プロジェクト: Krizzzn/shutupify
        public void PerformAction(JukeboxCommand cmd)
        {
            if (_remote == null)
                return;

            if (!_actionMapping.ContainsKey(cmd))
                return;

            var methodToCall = _actionMapping[cmd];
            _remote.GetType().GetMethod(methodToCall).Invoke(_remote, new object[0]);
        }
コード例 #18
0
ファイル: HotkeysProbe.cs プロジェクト: Krizzzn/shutupify
        private void RegisterHotKey(string hotkeyCombination, JukeboxCommand spotifyCommand)
        {
            var k = ParseKeyString(hotkeyCombination);
            if (k == Keys.None)
                return;

            var hotkey = new ManagedWinapi.Hotkey();
            if (hotkey.Enabled)
                hotkey.Enabled = false;

            hotkey.Alt = hotkeyCombination.Contains("ALT");
            hotkey.Ctrl = hotkeyCombination.Contains("CTRL") || hotkeyCombination.Contains("STRG");
            hotkey.Shift = hotkeyCombination.Contains("SHIFT");

            if (!hotkey.Alt && !hotkey.Ctrl && !hotkey.Shift) {
                hotkey.Dispose();
                return;
            }

            hotkey.KeyCode = k;

            hotkey.HotkeyPressed += (s, e) => {
                if (ReactOnEvent != null)
                    ReactOnEvent(spotifyCommand);
            };
            this._hotkeys.Add(hotkey);
        }
コード例 #19
0
 public void PerformAction(JukeboxCommand cmd)
 {
 }