Created
September 12, 2011 20:25
-
-
Save jmarnold/1212301 to your computer and use it in GitHub Desktop.
Hmmm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DiagnosticsTemplateBinder : ITemplateBinder | |
{ | |
public bool CanBind(IBindRequest request) | |
{ | |
var descriptor = request.Target.Descriptor as ViewDescriptor; | |
if(descriptor == null || descriptor.ViewModel == null) | |
{ | |
return false; | |
} | |
return descriptor.ViewModel.Assembly.Equals(GetType().Assembly); | |
} | |
public void Bind(IBindRequest request) | |
{ | |
var master = request | |
.TemplateRegistry | |
.ByOrigin("FubuMVC.Diagnostics") | |
.FirstOrDefault(t => t.Name().ToLower().Equals("application") && t.DirectoryPath().ToLower().Equals("shared")); | |
if(master == null) | |
{ | |
return; | |
} | |
request | |
.Target | |
.As<ViewDescriptor>() | |
.Master = master; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment