private void Form1_Load(object sender, EventArgs e) { choose = 0; player = null; audio = null; getUser = new Thread(userLoad); getAudio = new Thread(audioLoad); Play = new Thread(startPlayer); HelpBranch = new Thread(volumeChange); }
public void audioLoad() { Thread.Sleep(1000); if (!vk_music.Properties.Settings.Default.auth) { return; } String request = "https://api.vk.com/method/audio.get.xml?oid="; request += Convert.ToString(vk_music.Properties.Settings.Default.uid) + "&"; request += "need_user=0&offset=0&count=0" + "&"; request += "access_token=" + vk_music.Properties.Settings.Default.token; Stream stream = Api.Request.Send(request); if (stream == null) getAudio.Abort(); TextReader TR = new StreamReader(stream); audio = AudioHand.loadFromStream(TR); if (audio.audio.Count == 0) { getUser.Abort(); } for (int i=0; i < audio.audio.Count; i++) { addAudio(i,i+1); } this.Invoke((MethodInvoker)delegate() { this.audioTable.Visible = true; //this.tableLayoutPanel1.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single; //make it in settings }); getAudio.Abort(); }