Beispiel #1
0
        public void RefreshDescription()
        {
            if (!DisplayInputParams.Get(Device.ProductGuid.ToString(), out var displayName, out var axisP, out var buttonsP, out var povsP) &&
                IsController)
            {
                DisplayInputParams.Get(DirectInputDeviceUtils.GetXboxControllerGuid(), out _, out axisP, out buttonsP, out povsP);
            }

            DisplayName = displayName ?? FixDisplayName(Device.InstanceName);
            if (OptionStrictIndices)
            {
                DisplayName += $@" (#{Index + 1})";
            }

            Proc(Axis, axisP);
            Proc(Buttons, buttonsP);
            Proc(Povs, povsP);

            void Proc(IEnumerable <IInputProvider> items, DisplayInputParams p)
            {
                foreach (var t in items)
                {
                    t.SetDisplayParams(p?.Name(t.Id), p?.Test(t.Id) ?? true);
                }
            }

            VisibleAxis    = Axis.Where(x => x.IsVisible).ToList();
            VisibleButtons = Buttons.Where(x => x.IsVisible).ToList();
            VisiblePovs    = Povs.Where(x => x.IsVisible).ToList();
            OnPropertyChanged(nameof(VisibleAxis));
            OnPropertyChanged(nameof(VisibleButtons));
            OnPropertyChanged(nameof(VisiblePovs));
        }
Beispiel #2
0
        public void RefreshDescription()
        {
            DisplayInputParams.Get(Device.ProductGuid.ToString(), out var displayName, out var axisP, out var buttonsP, out var povsP);
            DisplayName = displayName ?? FixDisplayName(Device.InstanceName);
            Proc(Axis, axisP);
            Proc(Buttons, buttonsP);
            Proc(Povs, povsP);

            void Proc(IEnumerable <IInputProvider> items, DisplayInputParams p)
            {
                foreach (var t in items)
                {
                    t.SetDisplayParams(p?.Name(t.Id), p?.Test(t.Id) ?? true);
                }
            }

            VisibleAxis    = Axis.Where(x => x.IsVisible).ToList();
            VisibleButtons = Buttons.Where(x => x.IsVisible).ToList();
            VisiblePovs    = Povs.Where(x => x.IsVisible).ToList();
            OnPropertyChanged(nameof(VisibleAxis));
            OnPropertyChanged(nameof(VisibleButtons));
            OnPropertyChanged(nameof(VisiblePovs));
        }