private static void Main(string[] args) { var api = new PlexBinding(ConfigurationManager.AppSettings["username"], ConfigurationManager.AppSettings["password"]); var devices = api.GetDevices(); var hubertDevice = devices["Hubert"]; var status = api.PlayBack.GetStatus(hubertDevice, devices.Values.Where(d => d.Provides.Contains("server"))); api.PlayBack.Pause(hubertDevice); api.PlayBack.Resume(hubertDevice); api.PlayBack.SkipPrevious(hubertDevice); api.PlayBack.SkipNext(hubertDevice); Console.ReadKey(); }
public MainWindowViewModel() { // We should use a service locator or an IoC container, just to make sure we are using the same instance of PlexBinding throughout the app. _api = PlexBinding.Instance.Value; var devices = _api.GetDevices(); _player = devices[ConfigurationManager.AppSettings["playerId"]]; _servers = devices.Values.Where(d => d.Provides.Contains("server")); // Let's make it sexier with RX and avoid overrunning Timer initiated tasks: http://www.zerobugbuild.com/?p=259 (because here, it DOES matter !) this.schedule = Scheduler.Default.ScheduleRecurringAction(TimeSpan.FromSeconds(1), this.UpdatePlayerState); Title = "Title"; Parent = "Parent"; ThumbnailLocation = "http://siliconangle.com/wp-content/plugins/special-recent-posts-pro/images/no-thumb.png"; SkipNextCommand = new DelegateCommand(OnSkipNext); SkipPreviousCommand = new DelegateCommand(OnSkipPrevious); PauseCommand = new DelegateCommand(OnPause); }