public void Run(string resourceKey, string cloudEndPoint = "") { Console.WriteLine("This example shows the details of devices " + "associated with a given 'native model name'."); Console.WriteLine($"The native model name can be retrieved by " + $"code running on the device (For example, a mobile app)."); Console.WriteLine($"For Android devices, see " + $"https://developer.android.com/reference/android/os/Build#MODEL"); Console.WriteLine($"For iOS devices, see " + $"https://gist.github.com/soapyigu/c99e1f45553070726f14c1bb0a54053b#file-machinename-swift"); Console.WriteLine("----------------------------------------"); ILoggerFactory loggerFactory = new LoggerFactory(); HttpClient httpClient = new HttpClient(); // Create a cloud request engine builder var cloudRequestEngineBuilder = new CloudRequestEngineBuilder(loggerFactory, httpClient) .SetResourceKey(resourceKey); // If a cloud endpoint has been provided then set the // cloud pipeline endpoint. if (string.IsNullOrWhiteSpace(cloudEndPoint) == false) { cloudRequestEngineBuilder.SetEndPoint(cloudEndPoint); } // Create the cloud request engine. using (var cloudEngine = cloudRequestEngineBuilder.Build()) // Create the property-keyed engine to process the // response from the request engine. using (var propertyKeyedEngine = new HardwareProfileCloudEngineBuilder(loggerFactory) .Build()) // Create the pipeline using the engines. using (var pipeline = new PipelineBuilder(loggerFactory) .AddFlowElement(cloudEngine) .AddFlowElement(propertyKeyedEngine) .Build()) { // Pass an iOS native model into the pipeline and // list the matching devices. AnalyseTac(nativemodel1, pipeline); // Repeat for an Android native model name. AnalyseTac(nativemodel2, pipeline); } }
public void Run(string resourceKey, string cloudEndPoint = "") { Console.WriteLine("This example shows the details of devices " + "associated with a given 'Type Allocation Code' or 'TAC'."); Console.WriteLine("More background information on TACs can be " + "found through various online sources such as Wikipedia: " + "https://en.wikipedia.org/wiki/Type_Allocation_Code"); Console.WriteLine("----------------------------------------"); ILoggerFactory loggerFactory = new LoggerFactory(); HttpClient httpClient = new HttpClient(); // Create a cloud request engine builder var cloudRequestEngineBuilder = new CloudRequestEngineBuilder(loggerFactory, httpClient) .SetResourceKey(resourceKey); // If a cloud endpoint has been provided then set the // cloud pipeline endpoint. if (string.IsNullOrWhiteSpace(cloudEndPoint) == false) { cloudRequestEngineBuilder.SetEndPoint(cloudEndPoint); } // Create the cloud request engine using (var cloudEngine = cloudRequestEngineBuilder.Build()) // Create the property-keyed engine to process the // response from the request engine. using (var propertyKeyedEngine = new HardwareProfileCloudEngineBuilder(loggerFactory) .Build()) // Create the pipeline using the engines. using (var pipeline = new PipelineBuilder(loggerFactory) .AddFlowElement(cloudEngine) .AddFlowElement(propertyKeyedEngine) .Build()) { // Pass a TAC into the pipeline and list the matching devices. AnalyseTac(TAC, pipeline); AnalyseTac(TAC2, pipeline); } }