private void CollectAvailableAdapters() { SystemCapabilities = new SystemCapabilities(); if (_selectedGraphicsProfile == null) { // This sets _selectedAdapterCapabilities and _selectedRenderQuality SystemCapabilities.SelectRecommendedAdapter(out _selectedAdapterCapabilities, out _selectedRenderQuality); _selectedGraphicsProfile = _selectedAdapterCapabilities.GetGraphicsProfileForQuality(_selectedRenderQuality); } else { // This sets _selectedAdapterCapabilities and _selectedRenderQuality _selectedAdapterCapabilities = SystemCapabilities.CreateAdapterCapabilitiesFromGraphicsProfile(_selectedGraphicsProfile); var isCustomRenderQuality = IsCustomRenderQuality(); if (isCustomRenderQuality) { _selectedRenderQuality = AdapterCapabilitiesBase.RenderQualityTypes.Custom; } else { _selectedRenderQuality = AdapterCapabilitiesBase.GetGraphicsProfileQuality(_selectedGraphicsProfile); } } }
/// <summary> /// Disposes SystemCapabilities class and its unmanaged resources /// </summary> public void Dispose() { if (_systemCapabilities != null) { _systemCapabilities.Dispose(); _systemCapabilities = null; } }
private void CollectAvailableAdapters() { SystemCapabilities = new SystemCapabilities(); if (_selectedGraphicsProfile == null) { // This sets _selectedAdapterCapabilities and _selectedRenderQuality SystemCapabilities.SelectRecommendedAdapter(out _selectedAdapterCapabilities, out _selectedRenderQuality); _selectedGraphicsProfile = _selectedAdapterCapabilities.GetGraphicsProfileForQuality(_selectedRenderQuality); } else { // This sets _selectedAdapterCapabilities and _selectedRenderQuality _selectedAdapterCapabilities = SystemCapabilities.CreateAdapterCapabilitiesFromGraphicsProfile(_selectedGraphicsProfile); _selectedRenderQuality = GetExistingRenderQuality(_selectedGraphicsProfile); } }
public void InitializeGraphicProfiles() { GraphicsProfile serializedGraphicsProfile = null; // First check if DXEngineGraphicProfile is set in application config file (this overrides saved setting) string dxEngineGraphicProfileText; if (_settingsStorage != null) { dxEngineGraphicProfileText = _settingsStorage.OverrideGraphicProfileText; } else { dxEngineGraphicProfileText = null; } if (!string.IsNullOrEmpty(dxEngineGraphicProfileText)) { try { serializedGraphicsProfile = GraphicsProfileSerializer.Deserialize(dxEngineGraphicProfileText, SystemCapabilities.AllAdapters, throwExceptions: false); } catch (Exception ex) { MessageBox.Show("Cannot serialize the GraphicsProfile setting in config file (appSettings is DXEngineGraphicProfile).\r\n\r\nError:\r\n" + ex.Message); } } // If GraphicsProfile is not yet set, read the GraphicsProfile setting saved to application's settings if (serializedGraphicsProfile == null && _settingsStorage != null) { dxEngineGraphicProfileText = _settingsStorage.UserGraphicProfileText; if (!string.IsNullOrEmpty(dxEngineGraphicProfileText)) { try { serializedGraphicsProfile = GraphicsProfileSerializer.Deserialize(dxEngineGraphicProfileText, SystemCapabilities.AllAdapters, throwExceptions: false); } catch { // UH - this should not happen (maybe the GraphicsProfile was serialized with previous version) } } } if (serializedGraphicsProfile != null) { // CreateArrayOfRecommendedGraphicsProfiles creates an array of GraphicsProfile where the first GraphicsProfile is serializedGraphicsProfile. // The following graphics profiles in the list are fallback GraphicsProfiles that can be used if serializedGraphicsProfile cannot be used (for example software rendering and wpf 3D) this.GraphicsProfiles = SystemCapabilities.CreateArrayOfRecommendedGraphicsProfiles(serializedGraphicsProfile); } else { // GraphicsProfile still not set - probably the first run or user never changed graphics profile manually // Use the recommended settings for this computer this.GraphicsProfiles = DXEngineSettings.Current.SystemCapabilities.GetRecommendedGraphicsProfiles(); } }