Esempio n. 1
0
        public static List <AndroidApp> GetAllAndroidApps()
        {
            List <AndroidApp> apps     = new List <AndroidApp>();
            String            packages = RunCommand("adb shell pm list package");

            String [] temstr   = packages.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            DataTable NameList = DataProcess.GetNameList("package_list.csv");

            foreach (String pcknm in temstr)
            {
                String pckname = pcknm.Replace("package:", "");
                pckname = pckname.Replace("\r", "");
                DataRow dr = NameList.Rows.Find(pckname);

                String name       = "";
                String suggestion = "";
                if (dr != null)
                {
                    name       = dr.ItemArray[1].ToString();
                    suggestion = dr.ItemArray[2].ToString();
                }
                AndroidApp temapp = new AndroidApp(pckname, name, suggestion);

                apps.Add(temapp);
            }
            return(apps);
        }
 public MainWindow()
 {
     InitializeComponent();
     //MessageBox.Show(Adb.RunCommand("adb version"));
     AppList.ItemsSource = DataProcess.GetApps().DefaultView;
     //AppList.ItemsSource = DataProcess.GetNameList("huawei_package_list.csv").DefaultView;
 }
        private void InstallBox_Drop(object sender, DragEventArgs e)
        {
            List <String> paths = new List <String>();

            foreach (var a in (System.Array)e.Data.GetData(DataFormats.FileDrop))
            {
                paths.Add("\"" + a.ToString() + "\"");
            }
            LogOutput.AppendText(DataProcess.InstallApps(paths));
            AppList.ItemsSource = DataProcess.GetApps().DefaultView;
        }
        private void UninstallButton_Click(object sender, RoutedEventArgs e)
        {
            DataTable dt = new DataTable("Uninstall App List");

            dt.Columns.Add("Package Names", typeof(String));
            dt.Columns.Add("App Names", typeof(String));
            dt.Columns.Add(new DataColumn("Check", typeof(String)));
            foreach (DataRowView a in AppList.ItemsSource)
            {
                DataRowView view = a;
                if (view.Row[3].ToString().Equals("Checked"))
                {
                    DataRow dr = dt.NewRow();
                    dr["Package Names"] = view["Package Names"];
                    dr["App Names"]     = view["App Names"];
                    dr["Check"]         = view["Check"];
                    dt.Rows.Add(dr);
                }
            }

            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("没有选中任何程序");
                return;
            }
            MessageBoxResult ret = MessageBox.Show("确认删除" + dt.Rows.Count.ToString() + "项程序吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);

            if (ret == MessageBoxResult.OK)
            {
                String log = DataProcess.UninstallAppList(dt);
                //String log = "";
                //MessageBox.Show(dt.Rows.Count.ToString() + "项已删除");
                LogOutput.AppendText(log);
                AppList.ItemsSource = DataProcess.GetApps().DefaultView;
            }
        }
 private void Fresh_Click(object sender, RoutedEventArgs e)
 {
     AppList.ItemsSource = DataProcess.GetApps().DefaultView;
 }