public BLETestViewModel()
        {
            Title = "BLE Test";

            ConnectCommand = new Command(async() => {
                if (await AnalyzerDevice.ConnectToDeviceAsync())
                {
                    MessagingCenter.Send(this, "DeviceConnectedOk");
                }
                else
                {
                    MessagingCenter.Send(this, "DeviceConnectedFailed");
                }
            });

            TestCommand = new Command(async() => {
                try
                {
                    if (await AnalyzerDevice.TestCommandAsync())
                    {
                        MessagingCenter.Send(this, "DeviceTestOk");
                    }
                    else
                    {
                        MessagingCenter.Send(this, "DeviceTestFailed");
                    }
                }
                catch (Exception ex)
                {
                    MessagingCenter.Send <BLETestViewModel, string>(this, "TestError", ex.Message);
                }
            });
        }
        public DeviceSettingsViewModel()
        {
            Title = "Device Settings";

            AppVersion = Assembly.GetEntryAssembly().GetName().Version.ToString();

            ConnectCommand = new Command(async() => {
                Device.BeginInvokeOnMainThread(() =>
                {
                    IsConnecting = true;
                    IsConnected  = false;
                });

                try
                {
                    if (await AnalyzerDevice.ConnectToDeviceAsync())
                    {
                        MessagingCenter.Send <DeviceSettingsViewModel>(this, "DeviceConnectedOk");
                    }
                    else
                    {
                        MessagingCenter.Send <DeviceSettingsViewModel>(this, "DeviceConnectedFailed");
                    }
                }
                catch (Exception ex)
                {
                    MessagingCenter.Send <DeviceSettingsViewModel, string>(this, "DeviceConnectedError", ex.Message);
                }

                Device.BeginInvokeOnMainThread(() =>
                {
                    IsConnecting = false;
                    IsConnected  = AnalyzerDevice.IsConnected();

                    if (IsConnected)
                    {
                        SerialNumber    = AnalyzerDevice.GetSerialNumber();
                        FirmwareVersion = AnalyzerDevice.GetFirmwareVersion();
                    }
                });
            });
        }