public override bool TryEnablePreferentialOrdering(DevicePreference preference) { DXCoreAdapterPreference *pPreferences = stackalloc DXCoreAdapterPreference[4]; int i = 0; _softwareOnly = preference.HasFlag(DevicePreference.Software) && !preference.HasFlag(DevicePreference.Hardware); if (!TryAdd(DevicePreference.Hardware, DXCoreAdapterPreference.Hardware)) { return(false); } if (!TryAdd(DevicePreference.LowPower, DXCoreAdapterPreference.MinimumPower)) { return(false); } if (!TryAdd(DevicePreference.HighPerformance, DXCoreAdapterPreference.HighPerformance)) { return(false); } Guard.ThrowIfFailed(_list.Ptr->Sort((uint)i, pPreferences)); return(true); bool TryAdd(DevicePreference devicePref, DXCoreAdapterPreference dxCorePref) { if (!preference.HasFlag(devicePref)) { return(true); } if (!_list.Ptr->IsAdapterPreferenceSupported(dxCorePref)) { return(false); } StackSentinel.StackAssert(i < 4); pPreferences[i++] = dxCorePref; return(true); } }
public virtual void WriteTo(XElement xE) { XElement xItem = null; if (FeedId != null) { xItem = new XElement(XName.Get("feedId", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(FeedId.Value.ToString()); xE.Add(xItem); } if (FeedItemId != null) { xItem = new XElement(XName.Get("feedItemId", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(FeedItemId.Value.ToString()); xE.Add(xItem); } if (Status != null) { xItem = new XElement(XName.Get("status", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(Status.Value.ToXmlValue()); xE.Add(xItem); } if (StartTime != null) { xItem = new XElement(XName.Get("startTime", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(StartTime); xE.Add(xItem); } if (EndTime != null) { xItem = new XElement(XName.Get("endTime", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(EndTime); xE.Add(xItem); } if (AttributeValues != null) { foreach (var attributeValuesItem in AttributeValues) { xItem = new XElement(XName.Get("attributeValues", "https://adwords.google.com/api/adwords/cm/v201609")); attributeValuesItem.WriteTo(xItem); xE.Add(xItem); } } if (PolicyData != null) { foreach (var policyDataItem in PolicyData) { xItem = new XElement(XName.Get("policyData", "https://adwords.google.com/api/adwords/cm/v201609")); policyDataItem.WriteTo(xItem); xE.Add(xItem); } } if (DevicePreference != null) { xItem = new XElement(XName.Get("devicePreference", "https://adwords.google.com/api/adwords/cm/v201609")); DevicePreference.WriteTo(xItem); xE.Add(xItem); } if (Scheduling != null) { xItem = new XElement(XName.Get("scheduling", "https://adwords.google.com/api/adwords/cm/v201609")); Scheduling.WriteTo(xItem); xE.Add(xItem); } if (CampaignTargeting != null) { xItem = new XElement(XName.Get("campaignTargeting", "https://adwords.google.com/api/adwords/cm/v201609")); CampaignTargeting.WriteTo(xItem); xE.Add(xItem); } if (AdGroupTargeting != null) { xItem = new XElement(XName.Get("adGroupTargeting", "https://adwords.google.com/api/adwords/cm/v201609")); AdGroupTargeting.WriteTo(xItem); xE.Add(xItem); } if (KeywordTargeting != null) { xItem = new XElement(XName.Get("keywordTargeting", "https://adwords.google.com/api/adwords/cm/v201609")); KeywordTargeting.WriteTo(xItem); xE.Add(xItem); } if (GeoTargeting != null) { xItem = new XElement(XName.Get("geoTargeting", "https://adwords.google.com/api/adwords/cm/v201609")); GeoTargeting.WriteTo(xItem); xE.Add(xItem); } if (GeoTargetingRestriction != null) { xItem = new XElement(XName.Get("geoTargetingRestriction", "https://adwords.google.com/api/adwords/cm/v201609")); GeoTargetingRestriction.WriteTo(xItem); xE.Add(xItem); } if (UrlCustomParameters != null) { xItem = new XElement(XName.Get("urlCustomParameters", "https://adwords.google.com/api/adwords/cm/v201609")); UrlCustomParameters.WriteTo(xItem); xE.Add(xItem); } }
public override bool TryEnablePreferentialOrdering(DevicePreference preference) { _enumByPreference = true; _preference = preference; return(true); }