本文整理汇总了C#中Field类的典型用法代码示例。如果您正苦于以下问题:C# Field类的具体用法?C# Field怎么用?C# Field使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Field类属于命名空间,在下文中一共展示了Field类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FieldWrapper
public FieldWrapper(Field field)
{
Sitecore.Diagnostics.Assert.ArgumentNotNull(field, "field");
_modified = false;
_field = field;
}
示例2: CustomizeCompomentForKeywordField
private void CustomizeCompomentForKeywordField(Component component)
{
component.Schema.RootElementName = "hasKeyword";
Field headingField = new Field() { Name = "heading", Values = new List<string> { "some heading" } };
FieldSet metadataFields = new FieldSet();
metadataFields.Add(headingField.Name, headingField);
Field keywordField = new Field()
{
Name = "keyword",
KeywordValues = new List<Keyword>()
{
new Keyword()
{
MetadataFields = metadataFields,
Id = Randomizer.AnyUri(1024),
Title = Randomizer.AnyString(33),
Description = Randomizer.AnyString(33)
}
}
};
component.Fields.Add(keywordField.Name, keywordField);
}
示例3: CustomFieldTypeValidation
protected override void CustomFieldTypeValidation(AssertPair<FieldDefinition, Field> assert, Field spObject, FieldDefinition definition)
{
var typedObject = spObject.Context.CastTo<FieldLookup>(spObject);
var typedDefinition = definition.WithAssertAndCast<LookupFieldDefinition>("model", value => value.RequireNotNull());
// https://github.com/SubPointSolutions/spmeta2/issues/310
// AllowMultipleValues - TRUE - LookupMulti
// AllowMultipleValues - FALSE - Lookup
assert.ShouldBeEqual((p, s, d) =>
{
var srcProp = s.GetExpressionValue(m => m.FieldType);
var dstProp = d.GetExpressionValue(m => d.TypeAsString);
var isValid = typedDefinition.AllowMultipleValues
? typedObject.TypeAsString == "LookupMulti"
: typedObject.TypeAsString == "Lookup";
return new PropertyValidationResult
{
Tag = p.Tag,
Src = srcProp,
Dst = dstProp,
IsValid = isValid
};
});
}
示例4: GetFallbackItem
/// <summary>
/// Gets the nearest set ancestor that has the field with a value
/// </summary>
/// <param name="field">The field.</param>
/// <returns></returns>
private Item GetFallbackItem(Field field)
{
using (new SecurityDisabler())
{
return field.Item.Axes.GetAncestors().Where(ancestor => DoesItemHaveFieldWithValue(ancestor, field.ID, true)).LastOrDefault();
}
}
示例5: VisitFieldDecl
public override bool VisitFieldDecl(Field field)
{
if (!VisitDeclaration(field))
return false;
var type = field.Type;
Declaration decl;
type.TryGetDeclaration(out decl);
string msg = "internal";
if (decl == null || (decl.GenerationKind != GenerationKind.Internal && !HasInvalidType(type, out msg)))
return false;
field.GenerationKind = GenerationKind.Internal;
var @class = (Class)field.Namespace;
var cppTypePrinter = new CppTypePrinter();
var typeName = type.Visit(cppTypePrinter);
Log.Debug("Field '{0}::{1}' was ignored due to {2} type '{3}'",
@class.Name, field.Name, msg, typeName);
return true;
}
示例6: Draw
private void Draw(Field field, FileInfo file)
{
var xMax = 10;
var yMax = field.RowCount;
var image = new Bitmap(xMax * BlockSize, yMax * BlockSize);
for (var y = 0; y < yMax; y++)
{
var row = field[y];
for (var x = 0; x < xMax; x++)
{
if ((Row.Flag[x] & row) != 0)
{
DrawPixel(image, x, y, Color.Red);
}
else
{
DrawPixel(image, x, y, Color.White);
}
}
}
image.Save(file.FullName, ImageFormat.Png);
}
示例7: Read
public Fields Read(AbstractConnection connection, string process, string prefix, string name, string schema, bool isMaster = false) {
var fields = new Fields();
using (var cn = connection.GetConnection()) {
cn.Open();
var sql = PrepareSql();
connection.Logger.EntityDebug(name, sql);
var results = cn.Query(sql, new { name, schema });
foreach (var result in results) {
var columnName = result.COLUMN_NAME;
var type = GetSystemType(result.DATA_TYPE);
var length = result.CHARACTER_MAXIMUM_LENGTH == "0" || result.CHARACTER_MAXIMUM_LENGTH == "-1" ? "64" : result.CHARACTER_MAXIMUM_LENGTH;
var fieldType = (bool)result.IS_PRIMARY_KEY ? (isMaster ? FieldType.MasterKey : FieldType.PrimaryKey) : FieldType.NonKey;
var field = new Field(type, length, fieldType, true, string.Empty) {
Name = columnName,
Entity = name,
Process = process,
Index = Convert.ToInt16(result.ORDINAL_POSITION - 1),
Schema = schema,
Input = true,
Precision = result.NUMERIC_PRECISION,
Scale = result.NUMERIC_SCALE,
Alias = prefix + columnName
};
fields.Add(field);
}
}
return fields;
}
示例8: GetContentByUrl
/// <summary>
/// Gets the raw string (xml) from the broker db by URL
/// </summary>
/// <param name="Url">URL of the page</param>
/// <returns>String with page xml or empty string if no page was found</returns>
public string GetContentByUrl(string Url)
{
Page page = new Page();
page.Title = Randomizer.AnyString(15);
page.Id = Randomizer.AnyUri(64);
page.Filename = Randomizer.AnySafeString(8) + ".html";
PageTemplate pt = new PageTemplate();
pt.Title = Randomizer.AnyString(20);
Field ptfieldView = new Field();
ptfieldView.Name = "view";
ptfieldView.Values.Add("Standard");
pt.MetadataFields = new FieldSet();
pt.MetadataFields.Add(ptfieldView.Name, ptfieldView);
page.PageTemplate = pt;
page.ComponentPresentations = new List<ComponentPresentation>();
string cpString = ComponentPresentationProvider.GetContent("");
page.ComponentPresentations.Add(SerializerService.Deserialize<ComponentPresentation>(cpString));
FieldSet metadataFields = new FieldSet();
page.MetadataFields = metadataFields;
return SerializerService.Serialize<Page>(page);
}
示例9: GetField
private object GetField(Field field)
{
if (_fields.ContainsKey(field))
return _fields[field];
return null;
}
示例10: BadBlockPlacementTest
public void BadBlockPlacementTest( int x, int y )
{
Field field = new Field( 2, 10 );
IBlock block = new Block();
block.Grid [ 2 ] [ 2 ] = Color.Tomato;
field.SetBlock( block, new Point( x, y ) );
}
示例11: GetFilterView
public PartialViewResult GetFilterView(Field targetField, string filterString)
{
FilterBag fb = FilterBag.createFromURLQuery(Request.QueryString.ToString());
ViewBag.FilterString = fb.JsonEncode();
ViewBag.inputID = Guid.NewGuid();
return PartialView("_FilterEditPartial", targetField);
}
示例12: BadBigBlockPlacementTest
public void BadBigBlockPlacementTest( int x, int y )
{
Field field = new Field( 5, 10 );
IBlock block = new Block();
createBigBlock( block );
field.SetBlock( block, new Point( x, y ) );
}
示例13: Post
public HttpResponseMessage Post(HttpRequestMessage request, CreateFieldCommand command)
{
var repository = new FieldRepository();
var field = new Field(command.Name, command.Description, command.DataType, command.FieldType);
repository.AddField(field);
return request.CreateResponse(HttpStatusCode.Created, new FieldViewModel(field));
}
示例14: Batch
public Batch(int id, double amountOfFruit, string team, double sellAbleAmount, Field field)
{
Id = id;
AmountOfFruit = amountOfFruit;
SellAbleAmount = sellAbleAmount;
Field = field;
}
示例15: TestLevel3Description
public void TestLevel3Description()
{
var field = new Field(3, 4, 1, 1, 'S');
Assert.That(field.GetSequence(), Is.EqualTo(new[] {1, 5, 9, 10, 6, 2, 3, 7, 11, 12, 8, 4}));
field = new Field(5, 2, 5, 2, 'N');
Assert.That(field.GetSequence(), Is.EqualTo(new[] {10, 8, 6, 4, 2, 1, 3, 5, 7, 9}));
}