private void backgroundWorker_setDataGridView_DoWork(object sender, DoWorkEventArgs e) { try { PM = new SharpAdbClient.DeviceCommands.PackageManager(Device); foreach (var item in PM.Packages) { if (!item.Value.Contains("/system/")) { MyPackages.Add(item); } } TotalPackage = MyPackages.Count; c = 0; foreach (var item in MyPackages) { oneRow.Clear(); oneRow.Add(item.Key); oneRow.Add(PM.GetVersionInfo(item.Key).VersionName); c++; backgroundWorker_setDataGridView.ReportProgress(c, oneRow.ToArray()); } } catch { ClosedForm = true; } }
public bool UnistallApk(string PackageName) { try { SharpAdbClient.DeviceCommands.PackageManager pm = new SharpAdbClient.DeviceCommands.PackageManager(Device); pm.UninstallPackage(PackageName); return(true); } catch (Exception) { return(false); } }