Ejemplo n.º 1
0
        private void DefaultButtonOnButtonPressed(object sender, EventArgs buttonPressedEventArgs)
        {
            // apply default settings
            var defaultConfig = new Config.ConfigObject();

            // refresh stuff on screen
            foreach (var control in scrollPanel.ContentPanel.Controls)
            {
                var ctrl = (Control)control;
                if (ctrl.Tag != null && ctrl.Tag is string)
                {
                    var propertyName = (string)ctrl.Tag;
                    var value        = new Config.ConfigObject().GetValueOf(propertyName);
                    if (ctrl is YamuiButtonToggle)
                    {
                        Config.Instance.SetValueOf(propertyName, defaultConfig.GetValueOf(propertyName));
                        ((YamuiButtonToggle)ctrl).Checked = (bool)value;
                    }
                    else if (ctrl is YamuiTextBox)
                    {
                        Config.Instance.SetValueOf(propertyName, defaultConfig.GetValueOf(propertyName));
                        ((YamuiTextBox)ctrl).Text = value.ToString();
                    }
                }
            }
            ApplySettings();
            Config.Save();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Reset an option, setting it to its default value
        /// </summary>
        private void OnUndoButton(object sender, EventArgs eventArgs)
        {
            var inputControl = (Control)((YamuiButtonImage)sender).Tag;
            var property     = (FieldInfo)inputControl.Tag;
            var defaultValue = new Config.ConfigObject().GetValueOf(property.Name);

            if (inputControl is YamuiComboBox)
            {
                ((YamuiComboBox)inputControl).SelectedIndex = Enum.GetNames(property.FieldType).IndexOf(defaultValue.ConvertToStr());
            }
            else if (inputControl is YamuiButtonToggle)
            {
                ((YamuiButtonToggle)inputControl).Checked = (bool)defaultValue;
            }
            else if (inputControl is YamuiTextBox)
            {
                ((YamuiTextBox)inputControl).Text = defaultValue.ConvertToStr();
            }

            OnFieldModified();
        }
Ejemplo n.º 3
0
        private void DefaultButtonOnButtonPressed(object sender, EventArgs buttonPressedEventArgs)
        {
            // apply default settings
            var defaultConfig = new Config.ConfigObject();

            // refresh stuff on screen
            foreach (var control in scrollPanel.ContentPanel.Controls) {
                var ctrl = (Control)control;
                if (ctrl.Tag != null && ctrl.Tag is string) {
                    var propertyName = (string) ctrl.Tag;
                    var value = new Config.ConfigObject().GetValueOf(propertyName);
                    if (ctrl is YamuiButtonToggle) {
                        Config.Instance.SetValueOf(propertyName, defaultConfig.GetValueOf(propertyName));
                        ((YamuiButtonToggle)ctrl).Checked = (bool) value;
                    } else if (ctrl is YamuiTextBox) {
                        Config.Instance.SetValueOf(propertyName, defaultConfig.GetValueOf(propertyName));
                        ((YamuiTextBox)ctrl).Text = value.ToString();
                    }
                }
            }
            ApplySettings();
            Config.Save();
        }