Exemple #1
0
        public Deployer(string desiredDevice, bool strict)
        {
            this.deviceInfo = Devices.Instance.GetMatchingDevice(desiredDevice, strict);

            if (this.deviceInfo == null)
            {
                throw new ConnectivityException(
                    string.Format(
                        "Could not find a device to launch. You requested '{0}', but the available devices were:\n{1}",
                        desiredDevice,
                        Devices.Instance));
            }

            var propertyInfo = this.deviceInfo.GetType().GetTypeInfo().GetDeclaredProperty("DeviceId");
            var deviceId = (string)propertyInfo.GetValue(this.deviceInfo);
            var connectableDevice =
                new MultiTargetingConnectivity(CultureInfo.CurrentUICulture.LCID).GetConnectableDevice(deviceId);
            this.Device = connectableDevice.Connect(true);
            Logger.Info("Target emulator: '{0}'", this.DeviceName);
        }
Exemple #2
0
        public Deployer(string desiredDevice, bool strict)
        {
            this.deviceInfo = Devices.Instance.GetMatchingDevice(desiredDevice, strict);

            if (this.deviceInfo == null)
            {
                throw new AutomationException(
                          string.Format(
                              "Could not find a device to launch. You requested '{0}', but the available devices were:\n{1}",
                              desiredDevice,
                              Devices.Instance));
            }

            var propertyInfo      = this.deviceInfo.GetType().GetTypeInfo().GetDeclaredProperty("DeviceId");
            var deviceId          = (string)propertyInfo.GetValue(this.deviceInfo);
            var connectableDevice =
                new MultiTargetingConnectivity(CultureInfo.CurrentUICulture.LCID).GetConnectableDevice(deviceId);

            this.Device = connectableDevice.Connect(true);
            Logger.Info("Target emulator: '{0}'", this.DeviceName);
        }