void clipboardWatcher_Tick(object sender, EventArgs e) { string clipboard = Clipboard.GetText(); if(clipboard == m_clipboard) return; m_clipboard = clipboard; const string playlistURL = "http://grooveshark.com/#!/playlist/"; if (!m_clipboard.StartsWith(playlistURL)) return; string[] tokens = m_clipboard.Substring(playlistURL.Length).Split('/'); string name = tokens[0]; string id = tokens[1]; foreach (Playlist pl in playlistsCLB.Items) if ((string)pl["PlaylistID"] == id) return; Hashtable h = new Hashtable(); Playlist p = new Playlist(h); p["Name"] = name; p["PlaylistID"] = id; m_gs._populatePlaylist(p); playlistsCLB.Items.Add(p); }
void getPlaylistsHandler(object sender, UploadStringCompletedEventArgs e) { m_playlists = new LinkedList<Playlist>(); JObject response = (JObject)JSON.JsonDecode(e.Result); JObject result = (JObject)response["result"]; ArrayList pl = (ArrayList)(result["Playlists"]); foreach (JObject t in pl) { Playlist p = new Playlist((JObject)t); m_playlists.AddLast(p); // Fetch songs of the all playlists in parallel _populatePlaylist(p); } GotPlaylists(this, m_playlists); }
void m_gs_SongListFetched(object sender, Playlist playlist) { if (playlistsCLB.SelectedItem == playlist) playlsitsCLB_SelectedValueChanged(playlistsCLB, null); }
public void _populatePlaylist(Playlist p) { JObject param = new JObject(); param.Add("playlistID", p["PlaylistID"]); JObject headerOverride = new JObject(); headerOverride.Add("client", "htmlshark"); Request("playlistGetSongs", param, new UploadStringCompletedEventHandler(populatePlaylistHandler), (object)p, headerOverride); }