. DesignerProperties, . Injection/Inversion of Control .
static class DesignerProperties
{
public bool IsInDesigner { get; }
public void DoSomething(string arg);
}
. ( T4 )
interface IDesignerProperties
{
bool IsInDesigner { get; }
void DoSomething(string arg);
}
class DesignerPropertiesWrapper : IDesignerProperties
{
public bool IsInDesigner
{
get { return DesignerProperties.IsInDesigner; }
}
public void DoSomething(string arg)
{
DesignerProperties.DoSomething(arg);
}
}
class DesignerpropertiesMock : IDesignerProperties
{
public bool IsInDesigner { get; set; }
}
class ViewModel
{
private readonly IDesignerProperties _designerProperties;
public ViewModel(IDesignerProperties designerProperties)
{
_designerProperties = designerProperties;
}
}
, .