예제 #1
0
        Task RefreshMapDeviceToList()
        {
            var list = new SortableBindingList <UserDevice>();

            // Exclude System/Virtual devices.
            UserDevice[] devices;
            lock (SettingsManager.UserDevices.SyncRoot)
            {
                devices = SettingsManager.UserDevices.Items
                          .Where(x => ShowSystemDevices || x.ConnectionClass != DEVCLASS.SYSTEM)
                          .ToArray();
            }
            list.AddRange(devices);
            list.SynchronizingObject = ControlsHelper.MainTaskScheduler;
            // If new list, item added or removed then...
            if (_currentData == null)
            {
                AttachDataSource(list);
            }
            else if (_currentData.Count != list.Count)
            {
                CollectionsHelper.Synchronize(list, _currentData);
            }
            return(null);
        }
예제 #2
0
		/// <summary>
		/// Show DInput devices for mapping to XInput virtual device.
		/// </summary>
		/// <returns></returns>
		async Task RefreshMapDeviceToList()
		{
			var list = SettingsManager.UserDevices.Items.ToList();
			if (MapDeviceToControllerMode)
			{
				// Exclude System/Virtual devices.
				lock (SettingsManager.UserDevices.SyncRoot)
				{
					list = list
						.Where(x => ShowSystemDevices || x.ConnectionClass != DEVCLASS.SYSTEM)
						.ToList();
				}
			}
			// Synchronize list.
			CollectionsHelper.Synchronize(list, _currentData);
		}