public void playPause() { new Task(() => { lock (operationLockObject) try { iTunes.PlayPause(); } catch (Exception) { } }).Start(); }
private List <Result> StandardMenu() { List <Result> results = new List <Result> { new Result() { Title = "Play/Pause", SubTitle = $"{_itApp.CurrentTrack.Name} - {_itApp.CurrentTrack.Artist} {TimeSpan.FromSeconds(_itApp.PlayerPosition).ToString(@"mm\:ss")} / {_itApp.CurrentTrack.Time}", IcoPath = "Images\\Itunes.png", //relative path to your plugin directory Action = e => { _itApp.PlayPause(); return(true); } }, new Result { Title = "Next song", SubTitle = "Agla Gaana", IcoPath = "Images\\Itunes.png", Action = e => { _itApp.NextTrack(); if (_itApp.PlayerState == ITPlayerState.ITPlayerStateStopped) { _itApp.Play(); } return(false); } }, new Result { Title = "Previous song", SubTitle = "Pichla Gaana", IcoPath = "Images\\Itunes.png", Action = e => { _itApp.PreviousTrack(); if (_itApp.PlayerState == ITPlayerState.ITPlayerStateStopped) { _itApp.Play(); } return(false); } } }; return(results); }