本文整理汇总了C#中TagModel类的典型用法代码示例。如果您正苦于以下问题:C# TagModel类的具体用法?C# TagModel怎么用?C# TagModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TagModel类属于命名空间,在下文中一共展示了TagModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Evaluate
public string Evaluate(TagModel model)
{
var builder = new StringBuilder();
IList list = ToList(GetIEnumerable(model));
int start = GetAutoValueAsInt("Begin", model).Value;
int end = GetAsInt(End, model) ?? list.Count;
int step = GetAutoValueAsInt("Step", model).Value;
string var = GetAutoValueAsString("Var", model);
string varStatus = GetAutoValueAsString("VarStatus", model);
model.PushTagStack();
var status = new ForEachStatus(list.Count, start, end);
if (list.Count > 0)
{
model.Tag[varStatus] = status;
for (int i = start; i < end; i += step)
{
status.Index = i;
model.Tag[var] = list[i];
builder.Append(GetAsString(Body, model) ?? String.Empty);
}
model.Tag[var] = null;
model.Tag[varStatus] = null;
}
model.PopTagStack();
return builder.ToString();
}
示例2: SetUp
public override void SetUp()
{
base.SetUp();
var model = new Hashtable();
_model = new TagModel(model);
_model.Page[FormatConstants.LOCALE] = new CultureInfo("en-US");
}
示例3: SetUp
public override void SetUp()
{
base.SetUp();
var model = new Hashtable();
_model = new TagModel(model);
_model.Page[FormatConstants.LOCALE] = CultureInfo.InvariantCulture;
}
示例4: NewTagViewController
public NewTagViewController (WorkspaceModel workspace)
{
this.model = new TagModel () {
Workspace = workspace,
};
Title = "NewTagTitle".Tr ();
}
示例5: GlobalResolveTest
public void GlobalResolveTest()
{
var model = new TagModel(new Reflection(new Hashtable()));
model.Global["ResolveNewValue"] = "abc";
Assert.That(model.Global["ResolveNewValue"], Is.EqualTo("abc"));
Assert.That(model["ResolveNewValue"], Is.EqualTo("abc"));
}
示例6: InternalEvaluate
public override object InternalEvaluate(TagModel model)
{
string dateStr = GetAutoValueAsString("Value", model);
CultureInfo culture = ParseLocale != null
? new CultureInfo(GetAsString(ParseLocale, model))
: (CultureInfo) model[FormatConstants.LOCALE];
var format =
(DateTimeFormatInfo) DateTimeFormatInfo.GetInstance(culture.DateTimeFormat).Clone();
DateTime? result = null;
if (!String.IsNullOrEmpty(dateStr))
{
if (GetAutoValueAsBool("Exact", model))
{
string pattern = GetAsString(Pattern, model) ?? GetPattern(model, format);
try
{
result = DateTime.ParseExact(dateStr, pattern, format);
} catch (FormatException)
{
throw TagException.ParseException(dateStr, "Date").Decorate(Context);
}
}
else
{
result = DateTime.Parse(dateStr, format);
}
}
return result;
}
示例7: Evaluate
public string Evaluate(TagModel model)
{
string result = GetAutoValueAsString("Value", model);
var escapeXml = GetAutoValueAsBool("EscapeXml", model);
result = result ?? String.Empty;
return escapeXml ? StringUtils.EscapeXml(result) : result;
}
示例8: ModelTest
public void ModelTest()
{
var model = new TagModel(new Reflection(new Hashtable()));
model.Model["NewValue"] = "abc";
Assert.That(model.Model["NewValue"], Is.EqualTo("abc"));
Assert.That(model[VariableScope.Model + ".NewValue"], Is.EqualTo("abc"));
}
示例9: Evaluate
public string Evaluate(TagModel model)
{
string locale = GetAsString(Value, model);
VariableScope scope = GetAutoValueAs<VariableScope>("Scope", model).Value;
model[scope + "." + FormatConstants.LOCALE] = new CultureInfo(locale);
return String.Empty;
}
示例10: InternalEvaluate
protected override object InternalEvaluate(TagModel model)
{
var builder = new StringBuilder();
builder.Append(GetAsUrl(Value, model) ?? String.Empty);
builder.Append(ParamsEvaluate(model));
return builder.ToString();
}
示例11: EvaluateNested
public XsltParameter EvaluateNested(TagModel model)
{
string name = GetAsString(Name, model) ?? String.Empty;
string nameSpaceUri = GetAsString(NameSpaceUri, model) ?? String.Empty;
object value = GetAutoValue("Value", model) ?? String.Empty;
return new XsltParameter(name, nameSpaceUri, value);
}
示例12: Evaluate
public static string Evaluate(ITagWithVariable tag, TagModel model)
{
object result = tag.InternalEvaluate(model);
string var = tag.GetAutoValueAsString("Var", model);
string scope = tag.GetAutoValueAsString("Scope", model);
model[scope + "." + var] = result;
return String.Empty;
}
示例13: InternalEvaluate
protected override object InternalEvaluate(TagModel model)
{
var urlBuilder = new StringBuilder();
urlBuilder.Append(GetAsUrl(Url, model));
urlBuilder.Append(ParamsEvaluate(model));
return ReadData(PlaceRequest(urlBuilder));
}
示例14: GetIEnumerable
public override IEnumerable GetIEnumerable(TagModel model)
{
string items = GetAsString(Items, model) ?? String.Empty;
string delims = GetAsString(Delims, model);
string[] tokens = items.Split(delims.ToCharArray());
return new ArrayList(tokens);
}
示例15: CheckParsingOfLocaleDefautScope
public void CheckParsingOfLocaleDefautScope()
{
var model = new TagModel(this);
var tag = new SetLocale();
tag.Value = new MockAttribute(new Constant("nl-NL"));
Assert.That(tag.Evaluate(model), Is.EqualTo(String.Empty));
Assert.That(model.Page[FormatConstants.LOCALE], Is.EqualTo(new CultureInfo("nl-NL")));
}