public void updateAccount(object account) { if (account is account) { this.account = (account)account; label3.Text = this.account.Username; label14.Text = this.account.FollowDate; label15.Text = this.account.SubDate; } updateCreditsAndCooldown(); updateGenresAndSoundbytes(); }
private void saveTwitchAuthDetails(string returnedData) { JObject resp = JObject.Parse(returnedData); if (resp.SelectToken("response_type").ToString() == "true") { JToken data = resp.SelectToken("data"); string username = data.SelectToken("name").ToString(); string appCodeStr = data.SelectToken("code").ToString(); string creditsStr = data.SelectToken("credits").ToString(); string lastSoundbyte = data.SelectToken("last_soundbyte").ToString(); string followDate = data.SelectToken("follow_date").ToString(); string subDate = data.SelectToken("sub_date").ToString(); int appcode, credits; int.TryParse(appCodeStr, out appcode); int.TryParse(creditsStr, out credits); account account = new account(username, appcode, credits, lastSoundbyte, followDate, subDate); parent.updateAccount(account); } }
private bool updateCreditsAndCooldown() { msgbox msgbox; if (account != null) { CallResponse resp = calls.getAccountSoundbyteData(account.Username, account.AppCode); switch (resp.Response) { case CallResponse.responseType.SUCCESS: if (resp.SatteliteData is account) { account = (account)resp.SatteliteData; textBox3.Text = account.Credits.ToString(); if (account.LastSubmission == "0") { textBox4.Text = "Ready for submission!"; } else { textBox4.Text = account.LastSubmission; } } return true; case CallResponse.responseType.FAILURE: msgbox = new msgbox(false, resp.ErrorData); msgbox.Show(); return false; default: return false; } } else { msgbox = new msgbox(false, "Invalid Twitch name or app code. Twitch name must be larger than 1 character and app code must be numeric."); msgbox.Show(); return false; } }