static async Task <int> Main(string[] args)
        {
            using (var deviceClient = await SelectAuthType())
            {
                var methodHandler = new MethodHandler(deviceClient);
                await methodHandler.RunMethodHandlerAsync().ConfigureAwait(false);

                var simulator = new Simulator(deviceClient);
                await simulator.RunSimulation().ConfigureAwait(false);
            }

            return(0);
        }
Пример #2
0
        static async Task <int> Main(string[] args)
        {
            var deviceConnectionString = Environment.GetEnvironmentVariable("DeviceConnectionString");

            var _ = deviceConnectionString ?? throw new ArgumentNullException("DeviceConnectionString", "Device connection string cannot be empty");

            using (var deviceClient = DeviceClient.CreateFromConnectionString(deviceConnectionString, transportType))
            {
                var methodHandler = new MethodHandler(deviceClient);
                await methodHandler.RunMethodHandlerAsync().ConfigureAwait(false);

                var simulator = new Simulator(deviceClient);
                await simulator.RunSimulation().ConfigureAwait(false);
            }

            return(0);
        }