public NowPlayingPanel(SonosClient sonos, string zgid) { InitializeComponent(); _Sonos = sonos; _ZoneGroup = zgid; Init(); _PlayMenu.Items.Add("Get Info"); _PlayMenu.ItemClicked += new ToolStripItemClickedEventHandler(_PlayMenu_ItemClicked); _Queue.ContextMenuStrip = _PlayMenu; _Queue.MouseDown += new MouseEventHandler(_PlayMenu_MouseDown); }
public void Dispatch(SonosClient c) { switch (Name) { case "OnMuteChanged": if (c.OnMuteChanged != null) c.OnMuteChanged((string)Args[0], (bool)Args[1]); break; case "OnPlayStateChanged": if (c.OnPlayStateChanged != null) c.OnPlayStateChanged((string)Args[0], (bool)Args[1]); break; case "OnQueueChanged": if (c.OnQueueChanged != null) c.OnQueueChanged((string)Args[0]); break; case "OnTick": if (c.OnTrackProgress != null) c.OnTrackProgress((string)Args[0], (int)Args[1]); break; case "OnTrackChanged": if (c.OnTrackChanged != null) c.OnTrackChanged((string)Args[0]); break; case "OnVolumeChanged": if (c.OnVolumeChanged != null) c.OnVolumeChanged((string)Args[0], (int)Args[1]); break; case "OnZoneGroupsChanged": if (c.OnZoneGroupsChanged != null) c.OnZoneGroupsChanged(); break; default: break;/*do nothing*/ } }
void GetAmazonAlbumArt(SonosClient.Metadata np) { if (np != null && !string.IsNullOrEmpty(np.Artist) && !string.IsNullOrEmpty(np.Album)) { string keywords = np.Artist + ": " + np.Album; BackgroundWorker bw = new BackgroundWorker(); bw.WorkerReportsProgress = false; bw.WorkerSupportsCancellation = false; bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); bw.DoWork += new DoWorkEventHandler(bw_DoWork); bw.RunWorkerAsync(keywords); } }