Пример #1
0
        public bool TriggerEvent(KodiEventMessage e)
        {
            switch (e.Source)
            {
            case "onPlayBackEnded":
                PlayBackEnded?.Invoke(null, new EventArgs());
                break;

            case "onPlayBackPaused":
                PlayBackPaused?.Invoke(null, new EventArgs());
                break;

            case "onPlayBackResumed":
                PlayBackResumed?.Invoke(null, new EventArgs());
                break;

            case "onPlayBackSeek":
                PlayBackSeek?.Invoke(null, new PlayBackSeekEventArgs(Convert.ToInt32(e.EventArgs[0]), Convert.ToInt32(e.EventArgs[1])));
                break;

            case "onPlayBackSeekChapter":
                PlayBackSeekChapter?.Invoke(null, new PlayBackSeekChapterEventArgs(Convert.ToInt32(e.EventArgs[0])));
                break;

            case "onPlayBackSpeedChanged":
                PlayBackSpeedChanged?.Invoke(null, new PlayBackSpeedChangedEventArgs(Convert.ToInt32(e.EventArgs[0])));
                break;

            case "onPlayBackStarted":
                PlayBackStarted?.Invoke(null, new EventArgs());
                break;

            case "onPlayBackStopped":
                PlayBackStopped?.Invoke(null, new EventArgs());
                break;

            case "onQueueNextItem":
                QueueNextItem?.Invoke(null, new EventArgs());
                break;

            default:
                PyConsole.WriteLine(string.Format("Unknown event '{0}' not handled", e.Source));
                return(false);
            }
            return(true);
        }
Пример #2
0
        public static bool DispatchPlayerEvent(KodiEventMessage e)
        {
            switch (e.Sender)
            {
            case "onPlayBackEnded":
                PlayBackEnded?.Invoke(e.Sender, new EventArgs());
                break;

            case "onPlayBackPaused":
                PlayBackPaused?.Invoke(e.Sender, new EventArgs());
                break;

            case "onPlayBackResumed":
                PlayBackResumed?.Invoke(e.Sender, new EventArgs());
                break;

            case "onPlayBackSeek":
                PlayBackSeek?.Invoke(e.Sender, new PlayBackSeekEventArgs(int.Parse(e.EventArgs[0]), int.Parse(e.EventArgs[1])));
                break;

            case "onPlayBackSeekChapter":
                PlayBackSeekChapter?.Invoke(e.Sender, new PlayBackSeekChapterEventArgs(int.Parse(e.EventArgs[0])));
                break;

            case "onPlayBackSpeedChanged":
                PlayBackSpeedChanged?.Invoke(e.Sender, new PlayBackSpeedChangedEventArgs(int.Parse(e.EventArgs[0])));
                break;

            case "onPlayBackStarted":
                PlayBackStarted?.Invoke(e.Sender, new EventArgs());
                break;

            case "onPlayBackStopped":
                PlayBackStopped?.Invoke(e.Sender, new EventArgs());
                break;

            case "onQueueNextItem":
                QueueNextItem?.Invoke(e.Sender, new EventArgs());
                break;

            default:
                PyConsole.WriteLine(string.Format("Unknown event '{0}' not handled", e.Sender));
                return(false);
            }
            return(true);
        }