예제 #1
0
        public DetailsForm()
        {
            InitializeComponent();

            tbInstructions.Text = UI.getLabel("Explanation").Replace("\\n", Environment.NewLine);

            this.SuspendLayout();

            // create controls for each key setting
            int i = 0;

            foreach (Keys key in KeyMap.dtKeys.Keys)
            {
                CreateControls(key, i++);
            }

            cbAutostart.Checked = Autostart.getRegistry();
            cbAutostart.Text    = UI.getLabel("Autostart");

            cbSound.Checked = Properties.Settings.Default.playSound;
            cbSound.Text    = UI.getLabel("PlaySound");

            // move buttons to the (new) bottom
            btnCancel.Location = new Point(btnCancel.Location.X, getYPosition(i + 1));
            btnSave.Location   = new Point(btnSave.Location.X, getYPosition(i + 1));

            this.ResumeLayout(false);
            this.PerformLayout();
        }
예제 #2
0
        /// <summary>
        /// save all settings from the generted controls and the static ones
        /// </summary>
        private void save()
        {
            foreach (var i in keyControls)
            {
                string propertyName = "delay" + i.Key.ToString();
                Properties.Settings.Default[propertyName] = Convert.ToInt32(i.Value.num.Value);
            }

            // autostart does get saved to the registry, not settings, to take effect
            if (cbAutostart.Checked != Autostart.getRegistry())
            {
                Autostart.setRegistry(cbAutostart.Checked);
            }

            Properties.Settings.Default.playSound = cbSound.Checked;

            Properties.Settings.Default.Save();
        }