Exemplo n.º 1
0
        private void OnVibrateEvent(object aObj, VibrateEventArgs aEvent)
        {
            var op = Dispatcher.InvokeAsync(async() =>
            {
                foreach (var device in _devices)
                {
                    if (device.SupportsMessage(typeof(SingleMotorVibrateCmd)))
                    {
                        await _bpServer.SendMessage(new SingleMotorVibrateCmd(device.Index, aEvent.VibrateValue));
                    }
                }
            });

            _ops.Add(op);
            op.Completed += OperationCompletedHandler;
        }
        private void OnVibrateEvent(object aObj, VibrateEventArgs aEvent)
        {
            var op = Dispatcher.InvokeAsync(async() =>
            {
                var currentDevices = DeviceListBox.SelectedItems.Cast <Device>().ToList();
                foreach (var device in currentDevices)
                {
                    if (device.Messages.Contains("SingleMotorVibrateCmd"))
                    {
                        await _bpServer.SendMessage(new SingleMotorVibrateCmd(device.Index, aEvent.VibrateValue));
                    }
                }
            });

            _ops.Add(op);
            op.Completed += OperationCompletedHandler;
        }