Exemplo n.º 1
0
        public BindingConfiguration CreatBindingConfiguration(IControlConfiguration dependency)
        {
            if (dependency == null)
            {
                throw new NullReferenceException("ControlConfiguraiton is null.");
            }

            BindingConfiguration configuration;

            switch (dependency.Mode)
            {
            case ControlMode.Standard:
                configuration = new BindingConfiguration();
                break;

            case ControlMode.Paging:
                configuration = new BindingConfiguration(((PagingConfiguration)dependency).Max);
                break;

            default:
                throw new NotSupportedException(dependency.Mode.ToString() + " is not supported yet.");
            }

            configuration.PropertyChanged += this.BindingConfigurationPropertyChangedHandler;

            return(configuration);
        }
Exemplo n.º 2
0
 public void AdjustBinding(ItemsControl itemsControl, BindingConfiguration configuration, string changedProperty)
 {
     if (changedProperty == "Skip")
     {
         itemsControl.ItemsSource = this.LoadFromOriginalSource(configuration).Skip(configuration.Skip).Take(configuration.Limit);
     }
 }
Exemplo n.º 3
0
        public void ResolveDependency(object dependency)
        {
            if (this.bindingConfiguration != null)
            {
                this.bindingConfiguration.PropertyChanged -= this.BindingConfigurationPropertyChangedHandler;
            }

            this.bindingConfiguration = this.CreatBindingConfiguration(dependency as IControlConfiguration);
        }
Exemplo n.º 4
0
 public void Bind(ItemsControl itemsControl, BindingConfiguration configuration)
 {
     if (configuration.Limit == int.MaxValue)
     {
         itemsControl.ItemsSource = this.LoadFromOriginalSource(configuration);
     }
     else
     {
         itemsControl.ItemsSource = this.LoadFromOriginalSource(configuration).Take(configuration.Limit);
     }
 }
Exemplo n.º 5
0
 public override IEnumerable <T> LoadFromFile(string path, BindingConfiguration configuration)
 {
     throw new NotImplementedException();
 }
 public override IEnumerable <T> LoadFromOriginalSource(BindingConfiguration configuration)
 {
     return(this.collection);
 }
Exemplo n.º 7
0
 public abstract IEnumerable <T> LoadFromOriginalSource(BindingConfiguration configuration);
Exemplo n.º 8
0
 private void BindingConfigurationPropertyChangedHandler(object sender, PropertyChangedEventArgs e)
 {
     this.bindingConfiguration = sender as BindingConfiguration;
     this.AdjustBinding(this.GetItemsControl(), this.bindingConfiguration, e.PropertyName);
 }
 public override IEnumerable <T> LoadFromOriginalSource(BindingConfiguration configuration)
 {
     return(this.LoadFromFile(this.path, configuration));
 }
 public abstract IEnumerable <T> LoadFromFile(string path, BindingConfiguration configuration);