/// <summary> Fetch information about a guild. </summary> /// <param name="code">Ally code of someone in the guild.</param> public async Task <GuildInfo> GetGuildInfo(AllyCode code) { GuildInfo[] retval; retval = await GetGuildInfo(new AllyCode[] { code }); return(retval?[0]); }
private void Ok() { // Validate code AllyCode ac; try { ac = new AllyCode(Code); } catch (ArgumentOutOfRangeException) { MessageBox.Show("Invalid ally code.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } // Return code to caller Ally = ac; Close(); }
/// <summary> Load new API credentials, and automatically invalidate tokens if anything changed. </summary> public void UpdateCredentials(string username, string password, string user_id, string ally_code) { bool dirty = false; if (username != Username) { Username = username; dirty = true; } if (password != Password) { Password = password; dirty = true; } if (uint.TryParse(user_id, out uint val)) { if (val != UserId) { UserId = val; dirty = true; } } AllyCode ac = new AllyCode(ally_code); if (ac != AllyCode) { AllyCode = ac; dirty = true; } // Invalidate existing tokens if anything changed if (dirty) { token = new AccessToken("", -9999); } }
private void Cancel() { Ally = AllyCode.None; Close(); }