Exemplo n.º 1
0
        private void RemoveActivationButtonModeFromAllProfiles(ModeActivationItem item)
        {
            foreach (var button in ModeProfileActivationButtons)
            {
                var device = Devices.FirstOrDefault(d => d.DeviceId == button.Value.DeviceId);
                if (device == null)
                {
                    continue;
                }

                foreach (var profile in device.ModeProfiles)
                {
                    var map = profile.Value.FirstOrDefault(m => m.MapId == item.ButtonId);

                    switch (map)
                    {
                    case HOTASAxis axisMap:
                    {
                        //ApplyShiftModePage(item.Key, item.Value.ButtonId, axisMap.ButtonMap);
                        //ApplyShiftModePage(item.Key, item.Value.ButtonId, axisMap.ReverseButtonMap);
                        break;
                    }

                    case HOTASButton buttonMap:
                    {
                        buttonMap.ResetShift();
                        break;
                    }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public bool RemoveModeProfile(ModeActivationItem item)
        {
            if (ModeProfileActivationButtons.ContainsValue(item))
            {
                RemoveActivationButtonModeFromAllProfiles(item);
                ModeProfileActivationButtons.Remove(item.Mode);

                foreach (var d in Devices)
                {
                    d.RemoveModeProfile(item.Mode);
                }

                Logging.Log.Debug($"DELETED Mode {item.Mode}!");

                if (ModeProfileActivationButtons.Count <= 0)
                {
                    return(true);
                }

                var firstMode = ModeProfileActivationButtons.Keys.FirstOrDefault();
                SetMode(firstMode);
                Logging.Log.Debug($"Setting Mode to {firstMode}!");
                return(true);
            }
            return(false);
        }