/// <summary> /// Adds the icon. /// </summary> /// <param name="method">The method.</param> /// <param name="height">The height.</param> private void AddIcon(Enum method, int height) { Bitmap icon = Resources.KeyGrey16; string iconToolTip = "This is a basic feature query."; if (method is CCPAPICharacterMethods) { CCPAPICharacterMethods apiMethod = (CCPAPICharacterMethods)method; if ((long)apiMethod == ((long)apiMethod & (long)CCPAPIMethodsEnum.AdvancedCharacterFeatures)) { icon = Resources.KeyGold16; iconToolTip = "This is an advanced feature query."; } } if (method is CCPAPIGenericMethods) { CCPAPIGenericMethods apiGenericMethod = (CCPAPIGenericMethods)method; if (CCPAPIGenericMethods.PlanetaryColonies.Equals(apiGenericMethod)) { icon = Resources.KeyGold16; iconToolTip = "This is an advanced feature query."; } } // Uncomment upon implementing an exclicit corporation monitor feature //if (method is APICorporationMethods) //{ // APICorporationMethods apiMethod = (APICorporationMethods)method; // if ((int)apiMethod == ((int)apiMethod & (int)APIMethodsEnum.AdvancedCorporationFeatures)) // { // icon = CommonProperties.Resources.KeyGold16; // iconToolTip = "This is an advanced feature query."; // } //} PictureBox tempPicture = null; try { tempPicture = new PictureBox(); toolTip.SetToolTip(tempPicture, iconToolTip); tempPicture.Location = new Point(0, height + (RowHeight - icon.Size.Height) / 2); tempPicture.Image = icon; tempPicture.Size = icon.Size; PictureBox picture = tempPicture; tempPicture = null; Controls.Add(picture); } finally { tempPicture?.Dispose(); } }
/// <summary> /// Finds the API key with access to the specified API method. /// </summary> /// <param name="method">The method.</param> /// <returns>The API key with access to the specified method or null if non found.</returns> public APIKey FindAPIKeyWithAccess(CCPAPICharacterMethods method) => CharacterTypeAPIKeys .FirstOrDefault(apiKey => apiKey.Monitored && (ulong)method == (apiKey.AccessMask & (ulong)method));