Esempio 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);
        }
Esempio 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);
     }
 }
Esempio n. 3
0
        public void ResolveDependency(object dependency)
        {
            if (this.bindingConfiguration != null)
            {
                this.bindingConfiguration.PropertyChanged -= this.BindingConfigurationPropertyChangedHandler;
            }

            this.bindingConfiguration = this.CreatBindingConfiguration(dependency as IControlConfiguration);
        }
Esempio 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);
     }
 }
Esempio 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);
 }
Esempio n. 7
0
 public abstract IEnumerable <T> LoadFromOriginalSource(BindingConfiguration configuration);
Esempio 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);