Ejemplo n.º 1
0
        private static async Task Go()
        {
            var menuOption = await Menu();

            switch (menuOption)
            {
            case 1:
                try
                {
                    await _DeviceConnectionExample.InitializeTrezorAsync();
                    await DisplayDataAsync();

                    _DeviceConnectionExample.Dispose();

                    GC.Collect();

                    await Task.Delay(10000);
                }
                catch (Exception ex)
                {
                    Console.Clear();
                    Console.WriteLine(ex.ToString());
                }
                Console.ReadKey();
                break;

            case 2:
                Console.Clear();
                DisplayWaitMessage();
                _DeviceConnectionExample.StartListening();
                break;
            }
        }
Ejemplo n.º 2
0
        private static async Task GoAsync()
        {
            var menuOption = await MenuAsync().ConfigureAwait(false);

            switch (menuOption)
            {
            case 1:
                try
                {
                    await _DeviceConnectionExample.InitializeTrezorAsync().ConfigureAwait(false);
                    await DisplayDataAsync().ConfigureAwait(false);

                    _DeviceConnectionExample.Dispose();

                    GC.Collect();

                    await Task.Delay(10000).ConfigureAwait(false);
                }
                catch (Exception ex)
                {
                    Console.Clear();
                    Console.WriteLine(ex.ToString());
                }
                Console.ReadKey();
                break;

            case 2:
                Console.Clear();
                DisplayWaitMessage();
                _DeviceConnectionExample.StartListening();
                break;

#if !LIBUSB
            case 3:

                Console.Clear();
                await DisplayTemperature().ConfigureAwait(false);

                while (true)
                {
                    await Task.Delay(1000).ConfigureAwait(false);
                }
#endif
            default:
                Console.WriteLine("That's not an option");
                break;
            }
        }