private void Form2_Load(object sender, EventArgs e) { string s = Text; Text = Adb.GetPhone(); if (Text == "") { MessageBox.Show("请用数据线连接手机,并打开开发者选项中的ADB调试!", "未检测到手机连接!"); Dispose(); } else { Adb.ScreencapNow(); pictureBox1.Image = Image.FromFile(@"E:\adb\1.png"); timer1.Enabled = true; } }
private void timer1_Tick(object sender, EventArgs e) { //刷新连接设备,并刷新页面 string s = Text; Text = Adb.GetPhone(); if (Text == "") { Text = "未连接"; button1.Enabled = false; button2.Enabled = false; button3.Enabled = false; button4.Enabled = false; } else { button1.Enabled = true; button2.Enabled = true; button4.Enabled = true; } }