本文整理汇总了C#中DeviceInfo.GetCapability方法的典型用法代码示例。如果您正苦于以下问题:C# DeviceInfo.GetCapability方法的具体用法?C# DeviceInfo.GetCapability怎么用?C# DeviceInfo.GetCapability使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceInfo
的用法示例。
在下文中一共展示了DeviceInfo.GetCapability方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUaProf
/// <summary>
/// Adds the device to the collection of devices with UA prof information.
/// If the device already exists the previous one is replaced.
/// </summary>
/// <param name="device">Device to be added.</param>
private void SetUaProf(DeviceInfo device)
{
foreach (int uaprof in UAPROF_CAPABILITIES)
{
string value = Strings.Get(device.GetCapability(uaprof));
// Don't process empty values.
if (String.IsNullOrEmpty(value)) continue;
// Clean the useragent prof.
value = CleanUaProf(value);
Uri url = null;
// If the url is not value don't continue processing.
if (!Uri.TryCreate(value, UriKind.Absolute, out url)) continue;
// Get the hashcode before locking the list and processing
// the device and hashcode.
int hashcode = value.GetHashCode();
lock (_uaprofs)
{
ProcessUaProf(device, hashcode);
}
// Add the domain to the list of domains for the handler.
lock (_uaProfDomains)
{
if (_uaProfDomains.Contains(url.Host) == false)
_uaProfDomains.Add(url.Host);
}
}
}