コード例 #1
0
ファイル: Mobile.xaml.cs プロジェクト: Atom-Tech/SGEA
        private void apk_Click(object sender, RoutedEventArgs e)
        {
            AndroidController a       = AndroidController.Instance;
            string            caminho = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SGEA\\SGEA.SGEA.apk";

            if (a.HasConnectedDevices)
            {
                caminho = "\"" + caminho + "\"";
                Device d = a.GetConnectedDevice(a.ConnectedDevices[0]);
                for (int i = 0; i < a.ConnectedDevices.Count; i++)
                {
                    d = a.GetConnectedDevice(a.ConnectedDevices[i]);
                    if (!d.SerialNumber.Contains("emulator"))
                    {
                        break;
                    }
                }
                var    ad = Adb.FormAdbShellCommand(d, false, "pm list packages SGEA.SGEA");
                string x  = Adb.ExecuteAdbCommand(ad);
                if (x != "package:SGEA.SGEA")
                {
                    var ade = Adb.FormAdbCommand(d, "install " + caminho);
                    Adb.ExecuteAdbCommand(ade);
                    Xceed.Wpf.Toolkit.MessageBox.Show("O aplicativo foi instalado com sucesso");
                }
                else
                {
                    Xceed.Wpf.Toolkit.MessageBox.Show("O aplicativo já está instalado");
                }
            }
            else
            {
                Xceed.Wpf.Toolkit.MessageBox.Show("Não há um celular Android conectado por USB");
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Franco28/MIA3TOOLKIT
 private void buttonRebootRecovery_Click(object sender, EventArgs e)
 {
     if (isConnected())
     {
         cAppend("Rebooting into recovery...");
         Adb.ExecuteAdbCommand(Adb.FormAdbCommand(" reboot recovery"));
         cAppend("Rebooting into recovery... {OK}");
     }
     else
     {
         cAppend("{RebootRecovery} Please connect your device...");
         return;
     }
 }