Ejemplo n.º 1
0
        public override void SetProperties(UserControl[] _controls)
        {
            Style = (string)((ComboBoxControl)_controls.Where(x => x is ComboBoxControl).FirstOrDefault()).Value;

            var vals = (_controls.Where(x => x.Tag is int i && i == 0).FirstOrDefault() as BoolControl).Values;

            for (byte i = 0; i < 7; i++)
            {
                EnabledButtons = EnabledButtons.SetBit(i, vals[i].A);
            }

            base.SetProperties(_controls);
        }
Ejemplo n.º 2
0
        public override UserControl[] GetPropertiesControls()
        {
            var props = base.GetPropertiesControls();

            props.OfType <BoolControl>().First().Visibility = System.Windows.Visibility.Collapsed;

            var styleComboBox = GetPropertyControl <ComboBoxControl>(Type + "SCS");

            styleComboBox.Title = Extensions.LocalizationManager.Get("Style");
            styleComboBox.Items = new System.Collections.ObjectModel.ObservableCollection <string>
            {
                "Basic",
                "Basketball",
                "Rugby",
                "American Football",
                "Custom"
            };
            styleComboBox.Value = Style;

            var customBool = GetPropertyControl <BoolControl>(Type + "CBC");

            var vals = new List <Pair <bool, string> >();

            for (byte i = 0; i < 7; i++)
            {
                vals.Add(new Pair <bool, string>(EnabledButtons.GetBit(i), GetHotkeys().Skip(1).ToArray()[i].Name));
            }
            customBool.Values = vals;
            customBool.Title  = "Active Buttons";
            customBool.Tag    = 0;

            var cbEnabled = new Binding("Value");

            cbEnabled.Source             = styleComboBox;
            cbEnabled.Converter          = NKristek.Wpf.Converters.ObjectToStringEqualsParameterToBoolConverter.Instance;
            cbEnabled.ConverterParameter = "Custom";
            BindingOperations.SetBinding(customBool, BoolControl.IsEnabledProperty, cbEnabled);



            return((new UserControl[] { styleComboBox, customBool }).Concat(props).ToArray());
        }