Last active
November 18, 2015 07:32
-
-
Save jwChung/d7500dacbf2b97e9fb50 to your computer and use it in GitHub Desktop.
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 interface IPageViewTracker | |
{ | |
IDisposable Track(Page page); | |
} | |
public class NamedPageViewTracker : IPageViewTracker | |
{ | |
public NamedPageViewTracker( | |
IPageViewTracker innerTacker, IPageViewNameProvider provider) | |
{ | |
if (innerTacker == null) | |
throw Error.That.ArgumentNull(nameof(innerTacker)); | |
if (provider == null) | |
throw Error.That.ArgumentNull(nameof(provider)); | |
InnerTacker = innerTacker; | |
Provider = provider; | |
} | |
public IPageViewTracker InnerTacker { get; } | |
public IPageViewNameProvider Provider { get; } | |
public IDisposable Track(Page page) | |
{ | |
if (Provider.GetPageViewName(page) == null) | |
return Disposable.Empty; | |
return InnerTacker.Track(page); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment