private void btn_connect_Click(object sender, EventArgs e) { var r = new Regex(@"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$"); string ipadress = @txt_ip.Text; if (r.Match(ipadress).Success) { string output = null; groupBox11.Enabled = false; tabControl1.Enabled = false; ThreadStart starter = () => { output = StandardIO.AdbCMDBackground("", "connect " + ipadress, ""); }; starter += () => { groupBox11.Invoke((MethodInvoker)(() => groupBox11.Enabled = true)); tabControl1.Invoke((MethodInvoker)(() => tabControl1.Enabled = true)); MessageBox.Show(output, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }; Thread thread = new Thread(starter) { IsBackground = true }; thread.Start(); } else { MessageBox.Show("Please enter a valid IP adress", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btn_packages_uninstall_Click(object sender, EventArgs e) { var s = "\"" + cbInstalledApps.SelectedItem + "\""; string serial = " -s " + GetSelectedSerialnumber(); string output = null; groupBox11.Enabled = false; tabControl1.Enabled = false; ThreadStart starter = () => { output = StandardIO.AdbCMDBackground("", "uninstall " + s, serial); }; starter += () => { groupBox11.Invoke((MethodInvoker)(() => groupBox11.Enabled = true)); tabControl1.Invoke((MethodInvoker)(() => tabControl1.Enabled = true)); MessageBox.Show(output, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }; Thread thread = new Thread(starter) { IsBackground = true }; thread.Start(); while (thread.IsAlive) { Application.DoEvents(); } RefreshInstalledAps(); }
//Get all the information private void GetInformationAndOpenViewer(string a, string b, string titel, int width = 850, int height = 606, FormWindowState windowstate = FormWindowState.Normal, bool needSerial = true) { if (cbSerials.SelectedItem != null) { string serial = GetSelectedSerialnumber(); Thread thr; if (needSerial)//append serial; { thr = new Thread(() => { ToViewer(StandardIO.AdbCMDBackground("", b, " -s " + serial), titel, width, height, windowstate); }); } else { thr = new Thread(() => { ToViewer(StandardIO.AdbCMDBackground("", b, ""), titel, width, height, windowstate); }); } thr.IsBackground = true; thr.Start(); while (thr.IsAlive) { groupBox11.Enabled = false; tabControl1.Enabled = false; Application.DoEvents(); //Cursor = Cursors.AppStarting; } groupBox11.Enabled = true; tabControl1.Enabled = true; //Cursor = Cursors.Default; } else { StandardIO.NoDeviceConnected(); } }
private void button3_Click(object sender, EventArgs e) { //about buttom; //StandardIO.AdbCMD("version"); //GetInformationAndOpenViewer("", "version", "ADBVersionInfo", 340, 150); String adb_version_from_cmd = StandardIO.AdbCMDBackground("", "version"); textBox1_about_pane.Text = adb_version_from_cmd; }
private void button4_Click(object sender, EventArgs e) { //adb help buttom; //StandardIO.AdbCMD("help"); //help cmd output is located in STDERR;use 2>&1 redirection; String adb_help_info = StandardIO.AdbCMDBackground("", "help 2>&1"); textBox1_about_pane.Text = adb_help_info; }
private void button2_Click(object sender, EventArgs e) { string serial = GetSelectedSerialnumber(); Thread thr = new Thread(() => { StandardIO.AdbCMDBackgroundNoReturn("", "shell su root busybox ifconfig wlan0 down", " -s " + serial); }); thr.Start(); Thread thr2 = new Thread(() => { StandardIO.AdbCMDBackground("", "shell su root busybox ifconfig wlan0 up", " -s " + serial); }); thr2.Start(); }
private void GetInstalledApps(string serial) { cbInstalledApps.Invoke((MethodInvoker)(() => { cbInstalledApps.Items.Clear(); })); string output = null; output = StandardIO.AdbCMDBackground("", "shell \"pm list packages -3 | cut -c9- | sort\"", " -s " + serial); foreach (var item in output.Split(new string[] { "\r\r\n", }, StringSplitOptions.RemoveEmptyEntries)) { cbInstalledApps.Invoke((MethodInvoker)(() => { cbInstalledApps.Items.Add(item); })); } }
private void RefreshInformationTextbox() { while (true) { string s = null; Thread tr = new Thread(() => { s = StandardIO.AdbCMDBackground("", "devices -l"); }); tr.Start(); tr.Join(); txt_devices.Invoke((MethodInvoker)(() => txt_devices.Text = s.ToUpper())); Thread.Sleep(3000); } }
private void button5_Click_1(object sender, EventArgs e) { groupBox11.Enabled = false; tabControl1.Enabled = false; ThreadStart starter = () => { StandardIO.AdbCMDBackground("", "disconnect", ""); }; starter += () => { groupBox11.Invoke((MethodInvoker)(() => groupBox11.Enabled = true)); tabControl1.Invoke((MethodInvoker)(() => tabControl1.Enabled = true)); MessageBox.Show("Successfully disconnected", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }; Thread thread = new Thread(starter) { IsBackground = true }; thread.Start(); }
private void btn_packages_install_Click_1(object sender, EventArgs e) { var s = "\"" + txt_packages_path.Text + "\""; string serial = " -s " + GetSelectedSerialnumber(); if (txt_packages_path.Text != "") { //StandardIO.AdbCMD("install " + s, " -s " + GetSelectedSerialnumber()); string output = null; groupBox11.Enabled = false; tabControl1.Enabled = false; ThreadStart starter = () => { output = StandardIO.AdbCMDBackground("", "install " + s, serial); }; starter += () => { groupBox11.Invoke((MethodInvoker)(() => groupBox11.Enabled = true)); tabControl1.Invoke((MethodInvoker)(() => tabControl1.Enabled = true)); MessageBox.Show(output, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }; Thread thread = new Thread(starter) { IsBackground = true }; thread.Start(); while (thread.IsAlive) { Application.DoEvents(); } RefreshInstalledAps(); } else { MessageBox.Show("Please select a file!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_phoneinformation_resetdpi_Click(object sender, EventArgs e) { StandardIO.AdbCMDBackground("", "shell wm density reset && tools\\adb reboot"); }
private void btn_phoneinformation_changedpi_Click(object sender, EventArgs e) { StandardIO.AdbCMDBackground("", "shell wm density " + txt_phoneinformation_dpi.Text + "&& tools\\adb reboot"); }