Exemple #1
0
        List <BaseBindingPanelFactory> GetAvailableBindingPanels()
        {
            PropertyWrapper property = null;
            List <BaseBindingPanelFactory> result = new List <BaseBindingPanelFactory>();

            if (propertyList.SelectedIndex >= 0)
            {
                property = propertyList.Items[propertyList.SelectedIndex] as PropertyWrapper;
            }

            if (property == null)
            {
                return(result);
            }

            Assembly archiverAssembly = this.GetType().Assembly;

            foreach (Type type in archiverAssembly.GetTypes())
            {
                if (type.IsSubclassOf(typeof(BaseBindingPanelFactory)))
                {
                    BaseBindingPanelFactory factory = (BaseBindingPanelFactory)Activator.CreateInstance(type);
                    if (factory != null && factory.CheckApplicability(element, property))
                    {
                        result.Add(factory);
                    }
                }
            }

            return(result);
        }
        override public bool CheckApplicability(object element, PropertyWrapper property)
        {
            Type type = property.PropertyType;

            if (type.Equals(typeof(Double)))
            {
                return(true);
            }

            return(false);
        }
Exemple #3
0
 System.Windows.Data.BindingBase GetExistingBinding(PropertyWrapper property)
 {
     if (activeBindings.ContainsKey(property))
     {
         return(activeBindings[property]);
     }
     else
     {
         return(property.GetBinding());
     }
 }
        override public bool CheckApplicability(object element, PropertyWrapper property)
        {
            Type type = property.PropertyType;

            if (type.Equals(typeof(System.Windows.Media.Brush)))
            {
                return(true);
            }

            return(false);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="attributes"></param>
        /// <returns></returns>
        public virtual PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            List <PropertyWrapper> result     = new List <PropertyWrapper>();
            List <PropertyInfo>    properties = PropertiesMap.GetProperties(controlledObject.GetType());

            foreach (PropertyInfo propertyInfo in properties)
            {
                if (PropertyWrapper.CheckIfApplicable(controlledObject, propertyInfo))
                {
                    result.Add(new PropertyWrapper(controlledObject, propertyInfo));
                }
            }
            return(new PropertyDescriptorCollection(result.ToArray()));
        }
Exemple #6
0
        override public bool CheckApplicability(object element, PropertyWrapper property)
        {
            Type        type  = property.PropertyType;
            List <Type> types = new List <Type>(new Type[] {
                typeof(Double),
                typeof(Int16),
                typeof(Int32),
                typeof(Boolean),
                typeof(Byte),
                typeof(Single),
                typeof(Char),
                typeof(Nullable <Boolean>),
                typeof(String)
            });

            if (types.Contains(type))
            {
                return(true);
            }

            return(false);
        }
Exemple #7
0
        public override void Initialize(object element, PropertyWrapper property, System.Windows.Data.BindingBase binding)
        {
            base.Initialize(element, property, binding);

            System.Windows.Data.Binding bind = binding as System.Windows.Data.Binding;
            if (bind != null)
            {
                ChannelDataProvider cdp = (ChannelDataProvider)bind.Source;
                AddChannel(cdp.Channel);

                ComposingConverter conv = bind.Converter as ComposingConverter;
                foreach (IValueConverter converter in conv.Converters)
                {
                    if (converter is RangeConverter)
                    {
                        checkBox1.Checked = true;
                        RangeConverter rc = converter as RangeConverter;
                        minEdit.Value = (Decimal)rc.Min;
                        maxEdit.Value = (Decimal)rc.Max;
                    }
                }
            }
        }
        public override void Initialize(object element, PropertyWrapper property, System.Windows.Data.BindingBase binding)
        {
            base.Initialize(element, property, binding);

            DependencyObject   depObj;
            DependencyProperty depProp;

            if (property.GetWpfObjects(out depObj, out depProp))
            {
                if (depObj.GetValue(depProp) is String)
                {
                    expressionEdit.Text = (string)depObj.GetValue(depProp);
                }
            }

            System.Windows.Data.MultiBinding bind = binding as System.Windows.Data.MultiBinding;
            if (bind != null)
            {
                expressionEdit.Text = (bind.Converter as ScriptConverter).Expression;

                channels.Clear();
                foreach (System.Windows.Data.BindingBase bindingBase in bind.Bindings)
                {
                    if (bindingBase is System.Windows.Data.Binding)
                    {
                        System.Windows.Data.Binding b = bindingBase as System.Windows.Data.Binding;
                        if (b.Source is ChannelDataProvider)
                        {
                            ChannelDataProvider src = (ChannelDataProvider)b.Source;
                            channels.Add(src.Channel);
                        }
                    }
                }
                FillChannelsGrid();
            }
        }
        public override void Initialize(object element, PropertyWrapper property, System.Windows.Data.BindingBase binding)
        {
            base.Initialize(element, property, binding);

            System.Windows.Data.Binding bind = binding as System.Windows.Data.Binding;
            if (bind != null)
            {
                ChannelDataProvider cdp = (ChannelDataProvider)bind.Source;
                AddChannel(cdp.Channel);
                SolidBrushConverter sbc = bind.Converter as SolidBrushConverter;
                minEdit.Value = (Decimal)sbc.MinValue;
                maxEdit.Value = (Decimal)sbc.MaxValue;
                startColorButton.BackColor = Color.FromArgb(
                    sbc.StartColor.A,
                    sbc.StartColor.R,
                    sbc.StartColor.G,
                    sbc.StartColor.B);
                endColorButton.BackColor = Color.FromArgb(
                    sbc.EndColor.A,
                    sbc.EndColor.R,
                    sbc.EndColor.G,
                    sbc.EndColor.B);
            }
        }
Exemple #10
0
 abstract public bool CheckApplicability(object element, PropertyWrapper property);
Exemple #11
0
 virtual public void Initialize(object element, PropertyWrapper property, System.Windows.Data.BindingBase binding)
 {
     this.element  = element;
     this.property = property;
 }