Ejemplo n.º 1
0
        public void SaveMapping()
        {
            backupMapping = mapping.Clone();

            try
            {
                if (mapping == null)
                {
                    return;
                }

                String mappingFilePath = GetMappingFilePath();

                XmlSerializer serializer = new XmlSerializer(typeof(InputControls));
                using (System.IO.TextWriter textWriter = new System.IO.StreamWriter(mappingFilePath))
                {
                    serializer.Serialize(textWriter, mapping.Controls);
                    textWriter.Close();
                }
            }
            catch (Exception e)
            {
                throw new Exception("There was an error while writing the input mapping for device \"" + DeviceName + "\": " + e.Message);
            }
        }
Ejemplo n.º 2
0
        public InputMapping Clone()
        {
            InputMapping clonedMapping = new InputMapping(validButtons, validAxes);

            clonedMapping.SetButtonMappings(controls.CameraSwapButton, controls.TakeOffButton, controls.LandButton, controls.HoverButton, controls.EmergencyButton, controls.FlatTrimButton);
            clonedMapping.SetAxisMappings(controls.RollAxisMapping, controls.PitchAxisMapping, controls.YawAxisMapping, controls.GazAxisMapping);
            return(clonedMapping);
        }
Ejemplo n.º 3
0
 protected void CreateMapping(List<String> validButtons, List<String> validAxes)
 {
     mapping = new InputMapping(validButtons, validAxes);
     if (!LoadMapping())
     {
         CreateStandardMapping();
     }
     backupMapping = mapping.Clone();
 }
Ejemplo n.º 4
0
 protected void CreateMapping(List <String> validButtons, List <String> validAxes)
 {
     mapping = new InputMapping(validButtons, validAxes);
     if (!LoadMapping())
     {
         CreateStandardMapping();
     }
     backupMapping = mapping.Clone();
 }
        public void DetermineMapping()
        {
            serializationUtils = new SerializationUtils();

            mapping = GetStandardMapping();
            LoadMapping();

            backupMapping = mapping.Clone();
        }
        public void SaveMapping()
        {
            backupMapping = mapping.Clone();

            try
            {
                if (mapping == null)
                {
                    return;
                }

                String mappingFilePath = GetMappingFilePath();

                DictionarySerializer.Serialize(mapping.Controls.Mappings, mappingFilePath);
            }
            catch (Exception e)
            {
                throw new Exception("There was an error while writing the input mapping for device \"" + DeviceName + "\": " + e.Message);
            }
        }
Ejemplo n.º 7
0
 public InputMapping Clone()
 {
     InputMapping clonedMapping = new InputMapping(validButtons, validAxes);
     clonedMapping.SetButtonMappings(controls.CameraSwapButton, controls.TakeOffButton, controls.LandButton, controls.HoverButton, controls.EmergencyButton, controls.FlatTrimButton);
     clonedMapping.SetAxisMappings(controls.RollAxisMapping, controls.PitchAxisMapping, controls.YawAxisMapping, controls.GazAxisMapping);
     return clonedMapping;
 }
Ejemplo n.º 8
0
        public void SaveMapping()
        {
            backupMapping = mapping.Clone();

            try
            {
                if (mapping == null)
                {
                    return;
                }

                String mappingFilePath = GetMappingFilePath();

                XmlSerializer serializer = new XmlSerializer(typeof(InputControls));
                using (System.IO.TextWriter textWriter = new System.IO.StreamWriter(mappingFilePath))
                {
                    serializer.Serialize(textWriter, mapping.Controls);
                    textWriter.Close();
                }
            }
            catch (Exception e)
            {
                throw new Exception("There was an error while writing the input mapping for device \"" + DeviceName + "\": " + e.Message);
            }
        }
Ejemplo n.º 9
0
 public void CopyMappingsFrom(InputMapping mapping)
 {
     SetButtonMappings(mapping.CameraSwapButton, mapping.TakeOffButton, mapping.LandButton, mapping.HoverButton, mapping.EmergencyButton, mapping.FlatTrimButton);
     SetAxisMappings(mapping.RollAxisMapping, mapping.PitchAxisMapping, mapping.YawAxisMapping, mapping.GazAxisMapping);
 }
Ejemplo n.º 10
0
 public void SetDefaultMapping()
 {
     CreateStandardMapping();
     backupMapping = mapping.Clone();
 }
Ejemplo n.º 11
0
 public void SetDefaultMapping()
 {
     CreateStandardMapping();
     backupMapping = mapping.Clone();
 }
        private void TakeOverMapping(InputMapping mapping)
        {
            textBoxAxisRoll.Text = mapping.RollAxisMapping;
            textBoxAxisPitch.Text = mapping.PitchAxisMapping;
            textBoxAxisYaw.Text = mapping.YawAxisMapping;
            textBoxAxisGaz.Text = mapping.GazAxisMapping;

            textBoxButtonTakeOff.Text = mapping.TakeOffButton;
            textBoxButtonLand.Text = mapping.LandButton;
            textBoxButtonHover.Text = mapping.HoverButton;
            textBoxButtonEmergency.Text = mapping.EmergencyButton;
            textBoxButtonFlatTrim.Text = mapping.FlatTrimButton;
            textBoxButtonChangeCamera.Text = mapping.CameraSwapButton;

            CheckForDoubleInput();
        }
Ejemplo n.º 13
0
 public GenericInput()
 {
     mapping       = new InputMapping(new List <String>(), new List <String>());
     backupMapping = mapping.Clone();
 }
Ejemplo n.º 14
0
 public void CopyValidButtonsAndAxesFrom(InputMapping mappingToCopyFrom)
 {
     validButtons = mappingToCopyFrom.ValidButtons;
     validAxes    = mappingToCopyFrom.ValidAxes;
 }
Ejemplo n.º 15
0
 public void CopyValidButtonsAndAxesFrom(InputMapping mappingToCopyFrom)
 {
     validButtons = mappingToCopyFrom.ValidButtons;
     validAxes = mappingToCopyFrom.ValidAxes;
 }
 public void CopyMappingFrom(ConfigurableInput input)
 {
     mapping       = input.mapping.Clone();
     backupMapping = input.backupMapping.Clone();
 }
 public void SetDefaultMapping()
 {
     mapping       = GetStandardMapping();
     backupMapping = mapping.Clone();
 }
 public void RevertMapping()
 {
     mapping = backupMapping.Clone();
 }
Ejemplo n.º 19
0
 public void RevertMapping()
 {
     mapping = backupMapping.Clone();
 }
Ejemplo n.º 20
0
 public void CopyMappingFrom(GenericInput input)
 {
     mapping = input.mapping.Clone();
     backupMapping = input.backupMapping.Clone();
 }
Ejemplo n.º 21
0
 public void CopyMappingsFrom(InputMapping mapping)
 {
     SetButtonMappings(mapping.CameraSwapButton, mapping.TakeOffButton, mapping.LandButton, mapping.HoverButton, mapping.EmergencyButton, mapping.FlatTrimButton);
     SetAxisMappings(mapping.RollAxisMapping, mapping.PitchAxisMapping, mapping.YawAxisMapping, mapping.GazAxisMapping);
 }
Ejemplo n.º 22
0
 public GenericInput()
 {
     mapping = new InputMapping(new List<String>(), new List<String>());
     backupMapping = mapping.Clone();
 }
        private void UpdateMapping(InputMapping mapping, Control control, String inputValue)
        {
            if (control == Control.AxisRoll) { mapping.RollAxisMapping = inputValue; }
            if (control == Control.AxisPitch) { mapping.PitchAxisMapping = inputValue; }
            if (control == Control.AxisYaw) { mapping.YawAxisMapping = inputValue; }
            if (control == Control.AxisGaz) { mapping.GazAxisMapping = inputValue; }

            if (control == Control.ButtonTakeoff) { mapping.TakeOffButton = inputValue; }
            if (control == Control.ButtonLand) { mapping.LandButton = inputValue; }
            if (control == Control.ButtonHover) { mapping.HoverButton = inputValue; }
            if (control == Control.ButtonEmergency) { mapping.EmergencyButton = inputValue; }
            if (control == Control.ButtonFlatTrim) { mapping.FlatTrimButton = inputValue; }
            if (control == Control.ButtonChangeCamera) { mapping.CameraSwapButton = inputValue; }
        }
Ejemplo n.º 24
0
 public void CopyMappingFrom(GenericInput input)
 {
     mapping       = input.mapping.Clone();
     backupMapping = input.backupMapping.Clone();
 }