本文整理汇总了C#中IBlock类的典型用法代码示例。如果您正苦于以下问题:C# IBlock类的具体用法?C# IBlock怎么用?C# IBlock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IBlock类属于命名空间,在下文中一共展示了IBlock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: bindPostOne
private void bindPostOne( IBlock listBlock, BlogPost post, BlogSetting s ) {
String status = string.Empty;
if (post.IsTop == 1) status = "<span class=\"lblTop\">[" + lang( "sticky" ) + "]</span>";
if (post.IsPick == 1) status = status + "<span class=\"lblTop\">[" + lang( "picked" ) + "]</span>";
if (post.AttachmentCount > 0) {
status = status + string.Format( "<span><img src=\"{0}\"/></span>", strUtil.Join( sys.Path.Img, "attachment.gif" ) );
}
String postLink = alink.ToAppData( post );
listBlock.Set( "blogpost.Status", status );
listBlock.Set( "blogpost.Title", post.Title );
listBlock.Set( "blogpost.Url", postLink );
String body = s.ListMode == BlogListMode.Full ? post.Content : strUtil.ParseHtml( post.Content, s.ListAbstractLength );
listBlock.Set( "blogpost.Body", body );
listBlock.Set( "author", ctx.owner.obj.Name );
listBlock.Set( "authroUrl", Link.ToMember( ctx.owner.obj ) );
listBlock.Set( "blogpost.CreateTime", post.Created.ToShortTimeString() );
listBlock.Set( "blogpost.CreateDate", post.Created.ToShortDateString() );
listBlock.Set( "blogpost.Hits", post.Hits );
String replies = post.Replies > 0 ?
string.Format( "<a href=\"{0}\">{1}(<span class=\"blogItemReviews\">{2}</span>)</a>", postLink + "#comments", lang( "comment" ), post.Replies ) :
string.Format( "<a href=\"{0}\">发表评论</a>", postLink + "#comments" );
listBlock.Set( "blogpost.ReplyCount", replies );
listBlock.Set( "blogpost.CategoryName", post.Category.Name );
listBlock.Set( "blogpost.CategoryLink", to( new CategoryController().Show, post.Category.Id ) );
String tags = post.Tag.List.Count > 0 ? "tag:" + post.Tag.HtmlString : "";
listBlock.Set( "blogpost.TagList", tags );
}
示例2: rotate
public ISlice rotate(Direction direction)
{
IBlock[,] new_positions = new IBlock[3, 3];
if (direction == Direction.left)
{
new_positions[0, 0] = _blocks[2, 0];
new_positions[1, 0] = _blocks[2, 1];
new_positions[2, 0] = _blocks[2, 2];
new_positions[0, 1] = _blocks[1, 0];
new_positions[1, 1] = _blocks[1, 1];
new_positions[2, 1] = _blocks[2, 1];
new_positions[0, 2] = _blocks[0, 0];
new_positions[1, 2] = _blocks[0, 1];
new_positions[2, 2] = _blocks[0, 2];
}
else
{
new_positions[2, 0] = _blocks[0, 0];
new_positions[2, 1] = _blocks[1, 0];
new_positions[2, 2] = _blocks[2, 0];
new_positions[1, 0] = _blocks[0, 1];
new_positions[1, 1] = _blocks[1, 1];
new_positions[2, 1] = _blocks[2, 1];
new_positions[0, 0] = _blocks[0, 2];
new_positions[0, 1] = _blocks[1, 2];
new_positions[0, 2] = _blocks[2, 2];
}
return new Slice(new_positions);
}
示例3: bindColumnList
private void bindColumnList( List<ContentSection> sectionList, int iRow, int columnCount, IBlock columnBlock )
{
for (int i = 1; i < (columnCount + 1); i++) {
columnBlock.Set( "App.ImgPath", sys.Path.Img );
columnBlock.Set( "column.Id", string.Concat( new object[] { "row", iRow, "_column", i } ) );
String ctitle = alang( "columnNo" );
columnBlock.Set( "column.Name", string.Format( ctitle, i ) );
columnBlock.Set( "column.Index", i );
int rowColumnId = cvt.ToInt( iRow + "" + i );
String addUrl = to( new ContentSectionController().Add, rowColumnId );
String addAutoUrl = to( new ContentSectionController().AddAuto, rowColumnId );
String addFeed = to( new ContentSectionController().AddFeed, rowColumnId );
String editUILink = to( new ContentSectionController().EditUI, rowColumnId );
columnBlock.Set( "column.AddModuleUrl", addUrl );
columnBlock.Set( "column.AddAutoSection", addAutoUrl );
columnBlock.Set( "column.AddFeed", addFeed );
columnBlock.Set( "column.EditUILink", editUILink );
List<ContentSection> sections = sectionService.GetByRowColumn( sectionList, iRow, i );
IBlock sectionBlock = columnBlock.GetBlock( "sectionList" );
bindSectionList( sections, sectionBlock );
columnBlock.Next();
}
}
示例4: Route
/// <summary>
/// Default Constructor of Route
/// </summary>
/// <param name="rt">Route Type</param>
/// <param name="end">destination block given PointRoute</param>
/// <param name="ID">DB ID of route given DefinedRoute</param>
/// <param name="blocks">List of blocks contained by that route</param>
public Route(RouteTypes rt, IBlock end, int ID, List<IBlock> blocks)
{
_routeType = rt;
_endBlock = end;
_routeID = ID;
_routeBlocks = blocks;
}
示例5: setBoard
private void setBoard( IBlock fbBlock, ForumBoard fb ) {
fbBlock.Set( "board.StyleClass", "" );
fbBlock.Set( "board.AddUrl", string.Format( "<a href='{0}' class='frmBox' title='" + alang( "addSubBoard" ) + "'>+" + lang( "add" ) + "</a>", to( AddSubBoard, fb.Id ) ) );
fbBlock.Set( "board.EditUrl", to( EditBoard, fb.Id ) );
fbBlock.Set( "board.DeleteUrl", to( DeleteBoard, fb.Id ) );
fbBlock.Set( "lineStyle", "" );
int categoryCount = categoryService.CountByBoard( fb.Id );
String categoryCountStr = categoryCount > 0 ? "(" + categoryCount + ")" : "";
String lnkSetCategory = string.Format( "<a href='{0}' class='frmBox' title='" + alang( "postCategoryAdmin" ) + "'>" + alang( "category" ) + "{1}</a>", to( new CategoryController().Admin, fb.Id ), categoryCountStr );
String imgUser = strUtil.Join( sys.Path.Img, "users.gif" );
String imgSecurity = strUtil.Join( sys.Path.Img, "security.gif" );
String lnkSetModerator = string.Format( "<a href='{0}' class='frmBox' title='" + alang( "setModerator" ) + "'><img src=\"{1}\"/> " + alang( "setModerator" ) + "</a>", to( new ModeratorController().List, fb.Id ), imgUser );
String lnkSetSecurity = string.Format( "<a href='{0}' class='frmBox' xwidth='600' title='" + alang( "setSecurity" ) + "'><img src=\"{1}\"/> " + alang( "setSecurity" ) + "</a>", to( new SecurityController().BoardSetting, fb.Id ), imgSecurity );
fbBlock.Set( "board.SetCategory", lnkSetCategory );
fbBlock.Set( "board.Moderator", moderatorService.GetModeratorText( fb.Moderator ) );
fbBlock.Set( "board.SetModerator", lnkSetModerator );
fbBlock.Set( "board.SetSecurity", lnkSetSecurity );
fbBlock.Set( "deleteMsg", alang( "exDeleteBoardTip" ) );
}
示例6: bindSectionList
private void bindSectionList( IBlock sectionBlock, IList sections )
{
foreach (ContentSection section in sections) {
String moreUrl = getMoreUrl( section );
String moreLink = getMoreLink( moreUrl );
String title = getTitle( section, moreUrl );
sectionBlock.Set( "section.Title", title );
sectionBlock.Set( "section.MoreLink", moreLink );
sectionBlock.Set( "section.CombineIds", section.CombineIds );
String marquee = section.GetMarquee();
if (strUtil.HasText( marquee )) {
String m = string.Format( "<marquee direction=\"{0}\" onMouseOver=\"stop()\" onMouseOut=\"start()\">", marquee );
sectionBlock.Set( "section.MarqueeStart", m );
sectionBlock.Set( "section.MarqueeEnd", "</marquee>" );
}
else {
sectionBlock.Set( "section.MarqueeStart", "" );
sectionBlock.Set( "section.MarqueeEnd", "" );
}
sectionBlock.Set( "section.Id", section.Id );
String content = getSectionContent( section );
sectionBlock.Set( "section.Content", content );
sectionBlock.Next();
}
}
示例7: ProcessRequest
/// <summary>
/// A helper method which treats serviceName as a method name in the Block and
/// calls the method with the provided arguments
/// </summary>
/// <param name="instance"></param>
/// <param name="serviceName"></param>
/// <param name="args"></param>
/// <returns></returns>
public static object ProcessRequest(Dictionary<string, MethodBase> serviceMethods, IBlock instance, string serviceName, params object[] args)
{
//for services with the same name we should provide a list of arg types - this cannot work
//maybe method takes object and we passed classA this way we won't be able to find the method
//but we can differ method with different number of arguments
string key = serviceName;
MethodBase mi = serviceMethods[key];
if (mi == null)
{
throw new Exception("Cannot find service " + serviceName + " with specified number of arguments (" + args.Length.ToString() + ")");
}
try
{
object[] param = DCRFHelper.GetInstance().ConvertParams(mi,args);
return mi.Invoke(instance, param);
}
catch (Exception exc)
{
string message = exc.Message;
Exception e = exc.InnerException;
while (e != null)
{
message += "(Inner: " + e.Message + ") ";
e = e.InnerException;
}
throw new Exception("Error executing service: " + message);
}
}
示例8: Invoke
public override void Invoke(IBlock block)
{
Block = block;
if (DateTime.Now > _readyTime)
{
PerformRandomAction();
if (_actionWasPerformed)
{
try
{
VerifyState();
}
catch
{
Logs.Add("Monkey Verification failed at " + Block.GetType());
throw;
}
Probability = _baseProbability;
_readyTime = DateTime.Now + _interval;
}
else
{
Probability += _baseProbability < 0.1 ? 0 : (1 - Probability) / 3;
}
}
}
示例9: CreateSpecificCatchClause
/// <summary>Creates a specific catch clause with given <paramref name="exceptionType"/> and <paramref name="catchBody"/>.</summary>
/// <param name="exceptionType">Type of the exception to catch.</param>
/// <param name="catchBody">Body of the created catch.</param>
/// <param name="variableName">A name for catch variable.</param>
public ISpecificCatchClause CreateSpecificCatchClause(IDeclaredType exceptionType, IBlock catchBody, string variableName)
{
var tryStatement = _factory.CreateStatement("try {} catch(Exception $0) {}", variableName) as ITryStatement;
if (tryStatement == null)
return null;
var catchClause = tryStatement.Catches[0] as ISpecificCatchClause;
if (catchClause == null)
return null;
if (catchBody == null)
{
catchBody = _factory.CreateBlock("{$1 // TODO: Handle the $0 $1}",
exceptionType.GetClrName().ShortName, Environment.NewLine);
}
if (exceptionType != null)
{
var exceptionDeclaration = catchClause.ExceptionDeclaration;
if (exceptionDeclaration == null)
return null;
#if R8
var declaredTypeUsageNode = _factory.CreateDeclaredTypeUsageNode(exceptionType);
#else
var declaredTypeUsageNode = _factory.CreateDeclaredTypeUsageNode(exceptionType, catchBody);
#endif
exceptionDeclaration.SetDeclaredTypeUsage(declaredTypeUsageNode);
}
catchClause.SetBody(catchBody);
return catchClause;
}
示例10: bindOneFeed
private void bindOneFeed( IBlock block, List<FeedView> feedList )
{
foreach (FeedView feed in feedList) {
if (feed.DataType.Equals( typeof( FriendShip ).FullName )) continue;
if (feed.Creator == null) continue;
block.Set( "feed.DataType", feed.DataType );
block.Set( "feed.UserFace", feed.Creator.PicSmall );
block.Set( "feed.UserLink", Link.ToMember( feed.Creator ) );
String creatorInfo = string.Format( "<a href='{0}'>{1}</a>", Link.ToMember( feed.Creator ), feed.Creator.Name );
String feedTitle = feedService.GetHtmlValue( feed.TitleTemplate, feed.TitleData, creatorInfo );
block.Set( "feed.Title", feedTitle );
String feedBody = feedService.GetHtmlValue( feed.BodyTemplate, feed.BodyData, creatorInfo );
block.Set( "feed.Body", feedBody );
block.Set( "feed.Created", feed.Created );
block.Set( "feed.BodyGeneral", getComment( feed.BodyGeneral ) );
block.Next();
}
}
示例11: bindPickedList
private void bindPickedList( IList serviceData, IBlock block ) {
for (int i = 1; i < serviceData.Count; i++) {
ContentPost post = serviceData[i] as ContentPost;
IPageAdminSection sectionController = BinderUtils.GetPageSectionAdmin( post, ctx, "AdminSectionShow" );
String typeIcon = sectionController.GetSectionIcon( post.SectionId );
String attIcon = post.Attachments > 0 ? BinderUtils.iconAttachment : "";
if (strUtil.HasText( post.TitleHome )) {
block.Set( "post.Title", post.TitleHome );
} else {
block.Set( "post.Title", post.Title );
}
block.Set( "post.Url", alink.ToAppData( post, ctx ) );
block.Set( "post.DataIcon", typeIcon );
block.Set( "post.AttachmentIcon", attIcon );
block.Set( "post.Created", post.Created.ToShortDateString() );
block.Next();
}
}
示例12: FireTrigger
protected override void FireTrigger(TableEvent tableEvent, IBlock context)
{
var e = new TriggerEvent(TriggerType.Callback, TriggerInfo.TriggerName, tableEvent.Table.TableInfo.TableName, tableEvent.EventTime, tableEvent.EventType,
tableEvent.OldRowId, tableEvent.NewRow);
context.Context.RegisterEvent(e);
}
示例13: GameMechanics
public GameMechanics(IField field, IBlockFactory blockFactory)
{
this.field = field;
this.blockFactory = blockFactory;
this.currentBlock = blockFactory.MakeBlock();
field.SetBlock(currentBlock, new Vector2(0, 0));
}
示例14: bindEditCmd
private void bindEditCmd( IBlock block, ContentPost post ) {
String lnkEdit = "";
lnkEdit = to( AddImgList, post.Id );
block.Set( "post.EditUrl", lnkEdit );
}
示例15: bindLink
private void bindLink( IBlock tpl, String lbl, object obj )
{
BlogPost post = obj as BlogPost;
String userLink = Link.ToUser( post.CreatorUrl );
String userFace = "";
if (strUtil.HasText( post.Creator.Pic )) {
//userFace = string.Format( "<a href='{0}'><img src='{1}'/></a><br/>", userLink, post.Creator.PicSmall );
tpl.Set("post.Face", post.Creator.PicSmall);
}
//userFace += string.Format( "<a href='{0}'>{1}</a>", userLink, post.Creator.Name );
String title = Regex.Replace(post.Title, key, "<font color=\"red\">" + key + "</font>", RegexOptions.IgnoreCase);
String abs = strUtil.HasText( post.Abstract ) ? post.Abstract : strUtil.ParseHtml( post.Content, 150 );
abs = Regex.Replace(abs, key, "<font color=\"red\">" + key + "</font>", RegexOptions.IgnoreCase);
//tpl.Set( "post.Face", userFace );
tpl.Set("post.Title", title);
tpl.Set( "post.Abstract", abs );
tpl.Set( "post.LinkShow", alink.ToAppData( post ) );
tpl.Set("post.userLink", userLink);
tpl.Set("post.Creator", post.Creator.Name);
tpl.Set("viewLink", alink.ToAppData(post));
tpl.Set("post.Hits", post.Hits);
tpl.Set("commentLink", alink.ToAppData(post) + "#reply");
tpl.Set("post.ReplyCount", post.Replies);
tpl.Set( "post.Number", i );
i++;
}