예제 #1
0
        public static IDeviceAccessManager WriteDeviceFalse(this IDeviceAccessManager deviceAccessManager,
                                                            IDevice <bool> device)
        {
            deviceAccessManager.WriteDevicesFalse(device.ToEnumerable());

            return(deviceAccessManager);
        }
예제 #2
0
        public static IDeviceAccessManager WriteDevicesTrue(this IDeviceAccessManager deviceAccessManager,
                                                            params IDevice <bool>[] devices)
        {
            deviceAccessManager.WriteDevicesTrue(devices as IEnumerable <IDevice <bool> >);

            return(deviceAccessManager);
        }
예제 #3
0
        public static IDeviceAccessManager WriteDevice <T>(this IDeviceAccessManager deviceAccessManager,
                                                           IDevice <T> device)
        {
            IEnumerable <IDevice <T> > deviceValuePairs = device.ToEnumerable();

            return(deviceAccessManager.WriteDevices(deviceValuePairs));
        }
예제 #4
0
        //        private static IEnumerable<Tuple<IDevice, object>> GetValuePairs<T>(IEnumerable<IDevice<T>> devices)
//        {
//            var tuples = from IDevice<T> item1 in devices
//                select new Tuple<IDevice, dynamic>(item1, item1.Value);
//
//            return tuples;
//        }

//        public static Task WriteDevicesAsync<T>(this IDeviceAccessManager deviceAccessManager,
//                                                IEnumerable<IDevice<T>> devices)
//        {
//            var devices2 = devices.ToList();
//
//            var values = devices2.Select(x => x.Stage).ToList();
//
//            return deviceAccessManager.WriteDevicesAsync(devices2, values);
//        }


/*        public static Task WriteDevicesAsync<T>(this IDeviceAccessManager deviceAccessManager,
 *                                              IEnumerable<IDevice<T>> devices)
 *      {
 *          var pairs = devices.Select(item1 => new Tuple<IDevice, dynamic>(item1, item1.Stage));
 *
 *          return deviceAccessManager.WriteDevicesAsync(pairs);
 *      }*/

        public static Task WriteDevicesAsync <T>(this IDeviceAccessManager deviceAccessManager,
                                                 IEnumerable <Tuple <IDevice <T>, T> > deviceValuePairs)
        {
            var devices = deviceValuePairs.Do(x => { x.Item1.Stage = x.Item2; }).Select(x => x.Item1);

            return(deviceAccessManager.WriteDevicesAsync(devices));
        }
예제 #5
0
        public static void WriteDevicesFalse(this IDeviceAccessManager deviceAccessManager,
                                             IEnumerable <IDevice <bool> > devices)
        {
            var devices2 = devices.ToList();
            var values   = devices2.Select(x => false);

            deviceAccessManager.WriteDevices(devices2, values);
        }
예제 #6
0
        public static IDeviceAccessManager WriteDevices <T>(this IDeviceAccessManager deviceAccessManager,
                                                            IEnumerable <IDevice <T> > devices)
        {
            var pairs = devices.Select(item1 => new Tuple <IDevice, dynamic>(item1, item1.Stage));

            deviceAccessManager.WriteDevices(pairs);

            return(deviceAccessManager);
        }
예제 #7
0
        public static IDeviceAccessManager WriteDevices <T>(this IDeviceAccessManager deviceAccessManager,
                                                            IEnumerable <IDevice <T> > devices,
                                                            IEnumerable <T> values)
        {
            var pairs = GetPairs(devices, values);

            deviceAccessManager.WriteDevices(pairs);
            return(deviceAccessManager);
        }
예제 #8
0
        public static IDeviceAccessManager WriteDevicesTrue(this IDeviceAccessManager deviceAccessManager,
                                                            IEnumerable <IDevice <bool> > devices)
        {
            var devices2 = devices.ToList();

            var values = devices2.Select(x => true);

            deviceAccessManager.WriteDevices(devices2, values);
            return(deviceAccessManager);
        }
예제 #9
0
        public static Task WriteDevicesAsync <T>(this IDeviceAccessManager deviceAccessManager,
                                                 IEnumerable <IDevice <T> > devices,
                                                 IEnumerable <T> values)
        {
            var enumerable = devices as IList <IDevice <T> > ?? devices.ToList();

            enumerable.CopyValuesFrom(values, (d, v) => d.Stage = v);

            return(deviceAccessManager.WriteDevicesAsync(enumerable));
        }
예제 #10
0
 public static IDeviceAccessManager WriteDevices <T>(this IDeviceAccessManager deviceAccessManager,
                                                     params IDevice <T>[] devices)
 {
     return(deviceAccessManager.WriteDevices(devices as IEnumerable <IDevice <T> >));
 }