Ejemplo n.º 1
0
        private async void ComboDevices_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!(sender is ComboBox combo))
            {
                return;
            }
            var address = combo.SelectedItem as string;

            txtDevice.Text     = ". . . .";
            txtAndroid.Text    = ". . . .";
            txtArch.Text       = ". . . .";
            txtSdk.Text        = ". . . .";
            gbAction.IsEnabled = false;

            if (!string.IsNullOrWhiteSpace(address))
            {
                var device = await adb.GetDevice(address);

                var isArchCompatible = apk.isAbiCompatible(device);
                var isSdkCompatible  = apk.isSdkCompatible(device);

                txtDevice.Text           = device.Name;
                txtAndroid.Text          = device.Android;
                txtArch.Text             = device.Abi;
                txtArch.Foreground       = isArchCompatible ? txtArch.Foreground : Brushes.Red;
                txtArch.ToolTip          = isArchCompatible ? null : "not compatible";
                txtSdk.Text              = device.Sdk.ToString();
                txtSdk.Foreground        = isSdkCompatible ? txtArch.Foreground : Brushes.Red;
                txtSdk.ToolTip           = isSdkCompatible ? null : "not compatible";
                gbAction.IsEnabled       = true;
                btnMenuInstall.IsEnabled = apk.canInstallTo(device);
            }
        }