Example #1
0
        private void CreateSingleActionButtonMapList()
        {
            for (var i = ButtonMap.Count; i > 1; i--)
            {
                ButtonMap.RemoveAt(i - 1);
            }

            for (var i = ReverseButtonMap.Count; i > 1; i--)
            {
                ReverseButtonMap.RemoveAt(i - 1);
            }

            if (ButtonMap.Count == 0)
            {
                ButtonMap.Add(new HOTASButton()
                {
                    MapId = 1, MapName = $"Axis Button 1", Type = HOTASButton.ButtonType.Button
                });
            }

            if (IsDirectional)
            {
                if (ReverseButtonMap.Count == 0)
                {
                    ReverseButtonMap.Add(new HOTASButton()
                    {
                        MapId = 1, MapName = $"Reverse Axis Button 1", Type = HOTASButton.ButtonType.Button
                    });
                }
            }
        }
Example #2
0
        private void CreateMultiActionButtonMapList(int segments)
        {
            //try not to lose any macros already established. if more segments, then don't lose any macros. if less segments only trim from bottom of list
            if (segments < ButtonMap.Count)
            {
                for (var i = ButtonMap.Count; i > segments; i--)
                {
                    ButtonMap.RemoveAt(i - 1);
                }
            }
            else
            {
                for (var i = ButtonMap.Count + 1; i <= segments; i++)
                {
                    ButtonMap.Add(new HOTASButton()
                    {
                        MapId = i, MapName = $"Axis Button {i}", Type = HOTASButton.ButtonType.Button
                    });
                }
            }

            if (IsDirectional)
            {
                if (segments < ReverseButtonMap.Count)
                {
                    for (var i = ReverseButtonMap.Count; i > segments; i--)
                    {
                        ReverseButtonMap.RemoveAt(i - 1);
                    }
                }
                else
                {
                    for (var i = ReverseButtonMap.Count + 1; i <= segments; i++)
                    {
                        ReverseButtonMap.Add(new HOTASButton()
                        {
                            MapId = i, MapName = $"Reverse Axis Button {i}", Type = HOTASButton.ButtonType.Button
                        });
                    }
                }
            }
        }
Example #3
0
        private HOTASButton GetMultiActionMap(int segment)
        {
            HOTASButton map;

            if (IsDirectional)
            {
                if (Direction == AxisDirection.Forward)
                {
                    map = ButtonMap.FirstOrDefault(m => m.MapId == segment);
                }
                else
                {
                    map = ReverseButtonMap.FirstOrDefault(m => m.MapId == segment);
                }
            }
            else
            {
                map = ButtonMap.FirstOrDefault(m => m.MapId == segment);
            }
            return(map);
        }
Example #4
0
        private HOTASButton GetSingleActionMap()
        {
            HOTASButton map;

            if (IsDirectional)
            {
                if (Direction == AxisDirection.Forward)
                {
                    map = ButtonMap.FirstOrDefault(m => m.MapId == 1);
                }
                else
                {
                    map = ReverseButtonMap.FirstOrDefault(m => m.MapId == 1);
                }
            }
            else
            {
                map = ButtonMap.FirstOrDefault(m => m.MapId == 1);
            }
            return(map);
        }
Example #5
0
        public void CalculateSegmentRange(int segments)
        {
            RemoveSegmentBoundaryHandlers();

            Segments.Clear();
            if (segments == 0)
            {
                ButtonMap.Clear();
                ReverseButtonMap.Clear();
                return;
            }

            if (!IsDirectional)
            {
                ReverseButtonMap.Clear();
            }

            CreateSegments(segments);

            CreateActionMapList();

            AddSegmentBoundaryHandlers();
        }