Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="deviceIdentity"></param>
        /// <param name="deviceId"></param>
        private static async void ManageDeviceJob(DeviceIdentity deviceIdentity, string deviceId)
        {
            var    jobClient   = JobClient.CreateFromConnectionString(deviceIdentity.GetConnectionString());
            string methodJobId = Guid.NewGuid().ToString();


            await deviceIdentity.StartMethodJob(methodJobId, jobClient, deviceId);

            Console.WriteLine("Started Twin Update Job");

            var result1 = deviceIdentity.MonitorJob(methodJobId, jobClient).Result;

            Console.WriteLine("Job Status : " + result1.Status);

            string twinUpdateJobId = Guid.NewGuid().ToString();

            await deviceIdentity.StartTwinUpdateJob(twinUpdateJobId, jobClient, deviceId);

            result1 = deviceIdentity.MonitorJob(twinUpdateJobId, jobClient).Result;
            Console.WriteLine("Job Status : " + result1.Status);
            Console.WriteLine("Press ENTER to exit.");
            Console.ReadLine();
        }