Skip to content

Instantly share code, notes, and snippets.

@ahjohannessen
Created May 4, 2011 14:44
Show Gist options
  • Save ahjohannessen/955334 to your computer and use it in GitHub Desktop.
Save ahjohannessen/955334 to your computer and use it in GitHub Desktop.
Temporary impl of binding provider
// Temporary : Needs discussion + test coverage (if used)
public class FubuBindingProvider : BindingProvider
{
private readonly ISparkItems _sparkItems;
public FubuBindingProvider (ISparkItems sparkItems)
{
_sparkItems = sparkItems;
}
public override IEnumerable<Binding> GetBindings (IViewFolder viewFolder)
{
var bindings = new List<Binding> ();
foreach (var binding in _sparkItems.ByName("bindings")) {
var file = viewFolder.GetViewSource (binding.ViewPath);
using (var stream = file.OpenViewStream())
using (var reader = new StreamReader(stream)) {
bindings.AddRange (LoadStandardMarkup (reader));
}
}
return bindings;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment