82 lines
1.6 KiB
Plaintext
82 lines
1.6 KiB
Plaintext
<#@ template debug="false" hostspecific="false" language="C#" #>
|
|
<#@ import namespace="System.Collections.Generic"#>
|
|
<#@ output extension=".cs" #>
|
|
<#
|
|
var singleList = new List<string>
|
|
{
|
|
"MainContent",
|
|
"LeftMainContent",
|
|
"NoUserContent"
|
|
};
|
|
var controlList = new List<string>
|
|
{
|
|
"GrowlDemoCtl",
|
|
"LoadingDemoCtl",
|
|
"ImageBrowserDemoCtl",
|
|
"ColorPickerDemoCtl",
|
|
"CarouselDemoCtl",
|
|
"CompareSliderDemoCtl",
|
|
"TimeBarDemoCtl",
|
|
"PaginationDemoCtl",
|
|
"AnimationPathDemoCtl"
|
|
};
|
|
var styleList = new List<string>
|
|
{
|
|
"ButtonDemoCtl",
|
|
"ToggleButtonDemoCtl",
|
|
"ExpanderDemoCtl",
|
|
"ProgressBarDemoCtl",
|
|
"TabControlDemoCtl"
|
|
};
|
|
#>
|
|
using System;
|
|
using CommonServiceLocator;
|
|
using GalaSoft.MvvmLight.Ioc;
|
|
|
|
namespace HandyControlDemo.UserControl
|
|
{
|
|
/// <summary>
|
|
/// 控件定位器
|
|
/// </summary>
|
|
public class ControlLocator
|
|
{
|
|
private ControlLocator()
|
|
{
|
|
<#foreach(var item in singleList){#>
|
|
SimpleIoc.Default.Register<<#=item#>>();
|
|
<#}#>
|
|
<#foreach(var item in controlList){#>
|
|
SimpleIoc.Default.Register<<#=item#>>();
|
|
<#}#>
|
|
<#foreach(var item in styleList){#>
|
|
SimpleIoc.Default.Register<<#=item#>>();
|
|
<#}#>
|
|
}
|
|
|
|
public static ControlLocator Instance => new Lazy<ControlLocator>(() => new ControlLocator()).Value;
|
|
|
|
#region Main
|
|
|
|
<#foreach(var item in singleList){#>
|
|
public <#=item#> <#=item#> => ServiceLocator.Current.GetInstance<<#=item#>>();
|
|
|
|
<#}#>
|
|
#endregion
|
|
|
|
#region Controls
|
|
|
|
<#foreach(var item in controlList){#>
|
|
public <#=item#> <#=item#> => new <#=item#>();
|
|
|
|
<#}#>
|
|
#endregion
|
|
|
|
#region Styles
|
|
|
|
<#foreach(var item in styleList){#>
|
|
public <#=item#> <#=item#> => new <#=item#>();
|
|
|
|
<#}#>
|
|
#endregion
|
|
}
|
|
} |