示例#1
0
        public void UpdateDevicesList()
        {
            var devices = AdbShell.GetDevices().Select((id) => new Device(id)).ToList();

            if (devices.Count > 0)
            {
                var myIdSets = new List <string>(devices.Select(c => c.Id));
                Devices.Clear();
                myIdSets.ForEach((x) => Devices.Add(new Device(x)));
                SelectedDevice = new Device(String.Empty);
            }
            else
            {
                Devices.Clear();
                SelectedDevice = new Device(String.Empty);
            }
            //Devices.Clear();
            //var devices = AdbShell.GetDevices().Select((id) => new Device(id)).ToList();
            //if (devices.Count > 0)
            //{
            //    SelectedDevice = new Device(String.Empty);
            //}
            //else
            //{
            //    SelectedDevice = new Device(String.Empty);
            //}
            //devices.ForEach((x) => Devices.Add(x));
        }
示例#2
0
        public void RemoveUsbEventHandler()
        {
            var devices = AdbShell.GetDevices().Select((id) => new Device(id)).ToList();

            if (devices.Count > 0)
            {
                var myIdSets = new List <string>(devices.Select(c => c.Id));
                var result   = Devices.Where(r => myIdSets.Contains(r.Id)).ToList();

                Devices.Clear();
                result.ForEach((x) => Devices.Add(x));

                if (SelectedDevice != null && !result.Any(c => c.Id == SelectedDevice.Id) && Devices.Count > 0)
                {
                    SelectedDevice = Devices[0];
                }
            }
            else
            {
                Devices.Clear();
                SelectedDevice = new Device(String.Empty);
            }
        }