Exemple #1
0
        public void Build()
        {
            var @namespace     = Settings.GetNamespace(_target);
            var settings       = Settings.GetSettings(_target);
            var bindingBuilder = new ValueBindingBuilder();
            var accessor       = Settings.CurrentStoreAccessor;
            var binding        = bindingBuilder
                                 .SetTargetAdapter(_target, _property)
                                 .SetSourceAdapter(accessor, _storeKey, @namespace, _name)
                                 .Build();

            settings.AddBinding(binding);
        }
Exemple #2
0
        public IEnumerable <ISettingBinding> ProvideBindings(DependencyObject target)
        {
            var builder          = new ValueBindingBuilder();
            var @namespace       = Settings.GetNamespace(target);
            var accessor         = Settings.CurrentStoreAccessor;
            var exceptionHandler = new DebugValueAdapterExceptionHandler(Property, target, Store, Setting, @namespace);
            var binding          = builder
                                   .SetTargetAdapter(target, Property)
                                   .SetSourceAdapter(accessor, Store, @namespace, Setting)
                                   .SetExceptionHandler(exceptionHandler.LogAndSwallowException)
                                   .Build();

            return(new[] { binding });
        }
Exemple #3
0
        private ISettingBinding BindColumn(
            DataGridColumn column,
            int columnIndex,
            DependencyProperty storedProperty,
            SettingsNamespace @namespace,
            ValueBindingBuilder builder)
        {
            var accessor      = Settings.CurrentStoreAccessor;
            var settingName   = GetSettingName(Setting, column, columnIndex, storedProperty);
            var targetAdapter =
                DecorateTargetAdapter(
                    CreateTargetAdapter(column, storedProperty),
                    column,
                    columnIndex,
                    storedProperty);
            var exceptionHandler = new DebugValueAdapterExceptionHandler(storedProperty.Name, column, Store, settingName, @namespace);
            var binding          = builder
                                   .SetTargetAdapter(targetAdapter)
                                   .SetSourceAdapter(accessor, Store, @namespace, settingName)
                                   .SetExceptionHandler(exceptionHandler.LogAndSwallowException)
                                   .Build();

            return(binding);
        }