private void Form1_Load(object sender, EventArgs e) { _pictures.Add(picTablet); _pictures.Add(picTablet2); _pictures.Add(picMobile1); _pictures.Add(picMobile2); _pictures.Add(picMobile3); _pictures.Add(picHeadphones1); _pictures.Add(picHeadphones2); _pictures.Add(picHeadphones3); picTablet.BackColor = picTablet2.BackColor = picMobile1.BackColor = picMobile2.BackColor = picMobile3.BackColor = picHeadphones1.BackColor = picHeadphones2.BackColor = picHeadphones3.BackColor = picSelected.BackColor = Color.Transparent; picTablet.Parent = picTablet2.Parent = picMobile1.Parent = picMobile2.Parent = picMobile3.Parent = picHeadphones3.Parent = picHeadphones2.Parent = picHeadphones1.Parent = picSelected.Parent = picBackground; RealWriteLine("------------------------------------"); RealWriteLine("Welcome to the Virtual Smart Display"); RealWriteLine("------------------------------------"); // Selected Device _currentDevice = GetDeviceLoop.Run("SmartDisplay", RealWriteLine); // Start up Hub client _sDeviceClient = DeviceClient.CreateFromConnectionString(_currentDevice.ConnectionString, TransportType.Mqtt); // Output current state to log GetStateMessage(out string messageString); RealWriteLine(string.Empty); RealWriteLine($"Current state: {messageString}"); SendDeviceToCloud(RealWriteLine); SetupIoTDevice(RealWriteLine); }
static void Main(string[] args) { Console.Clear(); Console.WriteLine("----------------------------------"); Console.WriteLine("Welcome to the Virtual Thermometer"); Console.WriteLine("----------------------------------"); // Selected Device _currentDevice = GetDeviceLoop.Run("Thermometer"); // Start up Hub client _sDeviceClient = DeviceClient.CreateFromConnectionString(_currentDevice.ConnectionString, TransportType.Mqtt); // Create a handler for the direct method calls _sDeviceClient.SetMethodHandlerAsync("GetState", GetState, null).Wait(); CommandLoop(); }