public MainForm()
        {
            InitializeComponent();

            droneControlMsg = new DroneControlMessage() { Type = "", Direction = "", Thrust = 0, TimeInMilliSecond = 0 };
            droneDataMsg = new DroneDataMessage() { Type = "droneData", Gps = new GPSData() { Latitude = 0.0, Longitude = 0.0, Elevation = 0.0 }, Magneto = new MagnetoData() { MX = 0, MY = 0, MZ = 0, Declination = 0 } };

            // Extract settings from local config file
            try
            {
                Properties.Settings.Default.Reload();
                dhConStringTextBox.Text = (string)Properties.Settings.Default["Microsoft_IoTHub_ConnectionString"];
            }
            catch
            {
                dhConStringTextBox.Text = "";
            }
            try
            {
                protocolGatewayHost.Text = (string)Properties.Settings.Default["Microsoft_Protocol_Gateway_Hostname"];
            }
            catch
            {
                protocolGatewayHost.Text = string.Empty;
            }
            // Initialize fields
            activeIoTHubConnectionString = dhConStringTextBox.Text;
            dateTimePicker.Value = DateTime.Now;
            groupNameTextBox.Text = DEFAULT_CONSUMER_GROUP;

            numericUpDownTTL.Maximum = MAX_TTL_VALUE;
            numericUpDownTTL.Value = MAX_TTL_VALUE;
            cancelMonitoringButton.Enabled = false;

            // Set up the DataGridView.
            devicesGridView.MultiSelect = false;
            devicesGridView.ScrollBars = ScrollBars.Both;

            updateDeviceButton.Enabled = false;
            deleteDeviceButton.Enabled = false;
        }
 private void DisplayCurrentData(DroneDataMessage droneDataMsg)
 {
     LatitudeCurrentTextBox.Text = droneDataMsg.Gps.Latitude.ToString();
     LongitudeCurrentTextBox.Text = droneDataMsg.Gps.Longitude.ToString();
     MxCurrentTextBox.Text = droneDataMsg.Magneto.MX.ToString();
     MyCurrentTextBox.Text = droneDataMsg.Magneto.MY.ToString();
     MzCurrentTextBox.Text = droneDataMsg.Magneto.MZ.ToString();
     DeclinationCurrentTextBox.Text = droneDataMsg.Magneto.Declination.ToString();
 }