SaveControls() static private method

Saves the current control configuration
static private SaveControls ( string FileOrNull ) : void
FileOrNull string An absolute file path if we are exporting the controls, or a null reference to save to the default configuration location
return void
示例#1
0
 //
 // SET CONTROL CUSTOM DATA
 //
 internal void SetControlKbdCustomData(Key key, Interface.KeyboardModifier keybMod)
 {
     if (isCustomisingControl)
     {
         Interface.CurrentControls[CustomControlIdx].Method   = Interface.ControlMethod.Keyboard;
         Interface.CurrentControls[CustomControlIdx].Key      = key;
         Interface.CurrentControls[CustomControlIdx].Modifier = keybMod;
         Interface.SaveControls(null);
         PopMenu();
         isCustomisingControl = false;
     }
 }
示例#2
0
 //
 // SET CONTROL CUSTOM DATA
 //
 internal void SetControlKbdCustomData(Key key, Interface.KeyboardModifier keybMod)
 {
     //Check that we are customising a key, and that our key is NOT the menu back key
     if (isCustomisingControl && key != MenuBackKey && CustomControlIdx < Interface.CurrentControls.Length)
     {
         Interface.CurrentControls[CustomControlIdx].Method   = Interface.ControlMethod.Keyboard;
         Interface.CurrentControls[CustomControlIdx].Key      = key;
         Interface.CurrentControls[CustomControlIdx].Modifier = keybMod;
         Interface.SaveControls(null, Interface.CurrentControls);
     }
     PopMenu();
     isCustomisingControl = false;
 }
示例#3
0
 internal void SetControlJoyCustomData(int device, Interface.JoystickComponent component, int element, int dir)
 {
     if (isCustomisingControl)
     {
         Interface.CurrentControls[CustomControlIdx].Method    = Interface.ControlMethod.Joystick;
         Interface.CurrentControls[CustomControlIdx].Device    = device;
         Interface.CurrentControls[CustomControlIdx].Component = component;
         Interface.CurrentControls[CustomControlIdx].Element   = element;
         Interface.CurrentControls[CustomControlIdx].Direction = dir;
         Interface.SaveControls(null);
         PopMenu();
         isCustomisingControl = false;
     }
 }
示例#4
0
        // export
        private void buttonControlsExport_Click(object sender, EventArgs e)
        {
            SaveFileDialog Dialog = new SaveFileDialog();

            Dialog.OverwritePrompt = true;
            //Dialog.InitialDirectory = Interface.GetControlsFolder();
            Dialog.Filter = Interface.GetInterfaceString("dialog_controlsfiles") + "|*.controls|" + Interface.GetInterfaceString("dialog_allfiles") + "|*";
            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                try {
                    Interface.SaveControls(Dialog.FileName);
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
        }
示例#5
0
        // export
        private void buttonControlsExport_Click(object sender, EventArgs e)
        {
            SaveFileDialog Dialog = new SaveFileDialog
            {
                OverwritePrompt = true,
                Filter          =
                    Translations.GetInterfaceString("dialog_controlsfiles") + @"|*.controls|" +
                    Translations.GetInterfaceString("dialog_allfiles") + @"|*"
            };

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                try {
                    Interface.SaveControls(Dialog.FileName, Interface.CurrentControls);
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
        }
示例#6
0
 internal void SetControlJoyCustomData(int device, Interface.JoystickComponent component, int element, int dir)
 {
     if (isCustomisingControl && CustomControlIdx < Interface.CurrentControls.Length)
     {
         if (JoystickManager.AttachedJoysticks[device] is JoystickManager.Raildriver)
         {
             Interface.CurrentControls[CustomControlIdx].Method = Interface.ControlMethod.RailDriver;
         }
         else
         {
             Interface.CurrentControls[CustomControlIdx].Method = Interface.ControlMethod.Joystick;
         }
         Interface.CurrentControls[CustomControlIdx].Device    = device;
         Interface.CurrentControls[CustomControlIdx].Component = component;
         Interface.CurrentControls[CustomControlIdx].Element   = element;
         Interface.CurrentControls[CustomControlIdx].Direction = dir;
         Interface.SaveControls(null, Interface.CurrentControls);
         PopMenu();
         isCustomisingControl = false;
     }
 }