예제 #1
0
        /// <summary>
        /// An update occurred in Bind Mode.
        /// We are passed a <see cref="BindingUpdate"/>, which only contains Index, SubIndex etc...
        /// ... however, the front end will need a <see cref="BindingReport"/>, so it can display the new binding to the user (ie it needs the Title)
        /// <see cref="GetInputBindingReport"/> is expected to perform this translation
        /// </summary>
        /// <param name="update"></param>
        private void OnBindModeUpdate(BindingUpdate update)
        {
            var bindModeUpdate = new BindModeUpdate {
                Device = DeviceDescriptor, Binding = GetInputBindingReport(update), Value = (short)update.Value
            };

            if (BindModeUpdate != null)
            {
                //ThreadPool.QueueUserWorkItem(cb => BindModeUpdate(this, bindModeUpdate));
                // Disabled, as does not seem to work while SubReq's Callback property is dynamic
                // Switching it to Action<int> breaks loads of stuff in UCR, so for now, just keep using ThreadPool
                Task.Factory.StartNew(() => BindModeUpdate(this, bindModeUpdate));
            }
        }
예제 #2
0
 private void BindModeHandler(object sender, BindModeUpdate e)
 {
     _bindModeCallback?.Invoke(new ProviderDescriptor {
         ProviderName = ProviderName
     }, e.Device, e.Binding, e.Value);
 }