diff --git a/Library/GoogleAnalyticsClientDotNet.Net45/Properties/AssemblyInfo.cs b/Library/GoogleAnalyticsClientDotNet.Net45/Properties/AssemblyInfo.cs index c5d3523..6ad393a 100644 --- a/Library/GoogleAnalyticsClientDotNet.Net45/Properties/AssemblyInfo.cs +++ b/Library/GoogleAnalyticsClientDotNet.Net45/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.22")] -[assembly: AssemblyFileVersion("1.0.0.22")] +[assembly: AssemblyVersion("1.0.0.23")] +[assembly: AssemblyFileVersion("1.0.0.23")] diff --git a/Library/GoogleAnalyticsClientDotNet.Net45/Utility/DeviceInformationService.cs b/Library/GoogleAnalyticsClientDotNet.Net45/Utility/DeviceInformationService.cs index 0c2c09d..bb126d4 100644 --- a/Library/GoogleAnalyticsClientDotNet.Net45/Utility/DeviceInformationService.cs +++ b/Library/GoogleAnalyticsClientDotNet.Net45/Utility/DeviceInformationService.cs @@ -1,8 +1,9 @@ -using Microsoft.Win32; -using System; +using System; using System.Linq; using System.Management; +using System.Threading.Tasks; using System.Windows.Input; +using Microsoft.Win32; namespace GoogleAnalyticsClientDotNet.Utility { @@ -31,7 +32,7 @@ public bool IsTouchEnabled public string ModelName { get; private set; - } + } = string.Empty; public string Name { @@ -56,7 +57,7 @@ public string SystemArchitecture public string SystemManufacturer { get; private set; - } + } = string.Empty; private static string uniqueId; public string UniqueId @@ -137,13 +138,23 @@ public DeviceInformationService() //initialize the searcher with the query it is supposed to execute using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query)) { - //execute the query - foreach (System.Management.ManagementObject process in searcher.Get()) + try { - //print system info - process.Get(); - SystemManufacturer = $"{process["Manufacturer"]}"; - ModelName = $"{process["Model"]}"; + Task.Run(() => + { + foreach (ManagementObject process in searcher.Get()) + { + //print system info + process.Get(); + SystemManufacturer = $"{process["Manufacturer"]}"; + ModelName = $"{process["Model"]}"; + } + } + ); + } + catch (Exception) + { + } } }