/// <summary> /// Returns the <see cref="CityVitalsWatchResolution"/> instance corresponding to the specified screen width and height. /// </summary> /// <param name="screenWidth">The width of the screen.</param> /// <param name="screenHeight">The height of the screen.</param> /// <returns> /// The <see cref="CityVitalsWatchResolution"/> instance corresponding to the specified screen width and height. /// </returns> public CityVitalsWatchResolution GetResolutionData(int screenWidth, int screenHeight) { CityVitalsWatchResolution resolutionData = null; foreach (var resolution in this.Resolutions) { if (resolution.ScreenWidth == screenWidth && resolution.ScreenHeight == screenHeight) { resolutionData = resolution; break; } } // If no resolution data was found, create new default data for the specified resolution if (resolutionData == null) { resolutionData = new CityVitalsWatchResolution(); resolutionData.ScreenWidth = screenWidth; resolutionData.ScreenHeight = screenHeight; this.Resolutions.Add(resolutionData); } return(resolutionData); }
/// <summary> /// Returns the <see cref="CityVitalsWatchResolution"/> instance corresponding to the specified screen width and height. /// </summary> /// <param name="screenWidth">The width of the screen.</param> /// <param name="screenHeight">The height of the screen.</param> /// <returns> /// The <see cref="CityVitalsWatchResolution"/> instance corresponding to the specified screen width and height. /// </returns> public CityVitalsWatchResolution GetResolutionData(int screenWidth, int screenHeight) { CityVitalsWatchResolution resolutionData = null; foreach (var resolution in this.Resolutions) { if (resolution.ScreenWidth == screenWidth && resolution.ScreenHeight == screenHeight) { resolutionData = resolution; break; } } // If no resolution data was found, create new default data for the specified resolution if (resolutionData == null) { resolutionData = new CityVitalsWatchResolution(); resolutionData.ScreenWidth = screenWidth; resolutionData.ScreenHeight = screenHeight; this.Resolutions.Add(resolutionData); } return resolutionData; }