private void OnPushClick(object sender, EventArgs e) { Adb.Device device; DeviceItem item; if ((item = (DevicesBox.SelectedItem as DeviceItem)) != null && ((device = item.Value).IsOnline)) { using (PushFile push = new PushFile()) { if (push.ShowDialog() == DialogResult.OK) { string local = push.GetLocalPath(); string remote = push.GetRemotePath(); if (string.IsNullOrEmpty(local)) { Console.WriteLine(Resources.OUTPUT_ENTER_LOCAL); } else if (!File.Exists(local)) { Console.WriteLine(Resources.OUTPUT_NOT_EXISTS, local); } else { Console.WriteLine(new String('-', CONSOLE_DIVIDER)); Console.WriteLine(Resources.OUTPUT_PUSHING, local, remote, device.Model, device.Serial); RunInBackground((a, b) => { Worker.ReportProgress(1); b.Result = Adb.Push(device.Serial, local, remote); Worker.ReportProgress(100); }, (a, b) => { if ((bool)b.Result) { Console.WriteLine(Resources.OUTPUT_PUSHING_SUCCESS, local); } else { Console.WriteLine(Resources.OUTPUT_PUSHING_FAILED, local); } }); } } } } else { Console.WriteLine(Resources.OUTPUT_DEVICE_OFFLINE); } }