本文整理汇总了C#中Rendering类的典型用法代码示例。如果您正苦于以下问题:C# Rendering类的具体用法?C# Rendering怎么用?C# Rendering使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rendering类属于命名空间,在下文中一共展示了Rendering类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Render
public override void Render(Rendering.Environment environment, Camera cam)
{
SpriteRenderer spriteRenderer = renderManager.SpriteRenderer;
spriteRenderer.Render(texture, WorldTransform, WorldTransform.GetTranslation().x,
WorldTransform.GetTranslation().y,
texture.Width * WorldTransform.GetScale().x, texture.Height * WorldTransform.GetScale().y, white);
}
开发者ID:ajmd17,项目名称:apexengine-sharp,代码行数:7,代码来源:Sprite.cs
示例2: ReplacePlaceholders
private void ReplacePlaceholders(string html, TextWriter writer, Rendering rendering)
{
var index = html.IndexOf(placeholderStartSearch, StringComparison.Ordinal);
if (index < 0)
{
writer.Write(html);
return;
}
var endOfStartTag = html.IndexOf(" -->", index, StringComparison.Ordinal);
var startOfKey = index + placeholderStartSearch.Length;
var placeHolderKey = html.Substring(startOfKey, endOfStartTag - startOfKey);
var endTag = string.Format(placeHolderEndSearch, placeHolderKey);
var endOfPlaceHolder = html.IndexOf(endTag, endOfStartTag, StringComparison.Ordinal);
if (endOfPlaceHolder < 0)
throw new Exception("Could not find end of placeholder " + placeHolderKey);
if (placeHolderKey.IndexOf("_cacheable", StringComparison.Ordinal) > placeHolderKey.LastIndexOf('/'))
//another way to cache placeholders is to have the name contain _cacheable
{
writer.Write(html.Substring(0, endOfPlaceHolder + endTag.Length));
}
else
{
writer.Write(html.Substring(0, index));
PipelineService.Get().RunPipeline<RenderPlaceholderArgs>("mvc.renderPlaceholder",
new RenderPlaceholderArgs(placeHolderKey, writer, rendering));
}
ReplacePlaceholders(html.Substring(endOfPlaceHolder + endTag.Length), writer, rendering);
}
开发者ID:TwentyGotoTen,项目名称:BoC.Sitecore.DonutCaching,代码行数:29,代码来源:RenderFromCache.cs
示例3: Initialize
public override void Initialize(Rendering rendering)
{
base.Initialize(rendering);
if (!string.IsNullOrEmpty(Item["Tabs"]))
{
MultilistField slides = Item.Fields["Tabs"];
if (slides != null)
{
Tabs = slides.GetItems().ToList();
}
}
var background = (ImageField)rendering.Item.Fields["BackgroundImage"];
if (background != null)
{
var mediaItem = background.MediaItem;
if (mediaItem != null)
{
BackgroundImageUrl = MediaManager.GetMediaUrl(mediaItem);
}
}
//if (rendering.Parameters != null)
//{
//var parms = rendering.Parameters;
//ActiveTab = parms["Active Tab"];
//}
if (!string.IsNullOrEmpty(Item["Active Tab"]))
{
ActiveTab = Item["Active Tab"];
}
}
开发者ID:BIGANDYT,项目名称:Spitfire,代码行数:31,代码来源:TabGroupModel.cs
示例4: GetFromViewPath
protected virtual object GetFromViewPath(Rendering rendering, GetModelArgs args)
{
var viewPath = rendering.ToString().Replace("View: ", string.Empty);
if(!SiteHelper.IsValidSite()) return null;
var useSynthesisModelType = SynthesisRenderingCache.GetOrAdd(rendering.ToString(), key =>
{
var renderer = rendering.Renderer;
var diagnosticRenderer = renderer as RenderingDiagnosticsInjector.DiagnosticsRenderer;
if (diagnosticRenderer != null) renderer = diagnosticRenderer.InnerRenderer;
var viewRenderer = renderer as ViewRenderer;
if (viewRenderer != null) viewPath = viewRenderer.ViewPath;
var modelType = _typeResolver.GetViewModelType(viewPath);
// Check to see if no model has been set
if (modelType == typeof(object)) return false;
// Check that the model is a Synthesis type (if not, we ignore it)
if (!typeof(IStandardTemplateItem).IsAssignableFrom(modelType)) return false;
return true;
});
return useSynthesisModelType ? rendering.Item.AsStronglyTyped() : null;
}
开发者ID:BerserkerDotNet,项目名称:Synthesis,代码行数:29,代码来源:GetFromSynthesis.cs
示例5: Initialize
public void Initialize(Rendering rendering)
{
SetDefault();
ContextItem = rendering.Item;
Initialize();
}
开发者ID:csulham,项目名称:OctoSource,代码行数:7,代码来源:DefaultRenderingModel.cs
示例6: Initialize
/// <summary>
/// The rendering of the context page
/// </summary>
/// <param name="rendering">Rendering to initialize</param>
public override void Initialize(Rendering rendering)
{
base.Initialize(rendering);
if (!string.IsNullOrEmpty(Item[FieldConstants.TeaserGroup.Source]))
{
MultilistField source = Item.Fields[FieldConstants.TeaserGroup.Source];
if (source != null)
{
OwlTeasers = source.GetItems().ToList();
}
}
// Findout dispaly social icons or not; this is droplist field
SocialDisplay = Item[FieldConstants.TeaserGroup.Display];
if (string.IsNullOrEmpty(SocialDisplay) || string.Equals(SocialDisplay, "show", StringComparison.CurrentCultureIgnoreCase))
{
SocialDisplay = "show";
}
if (string.Equals(SocialDisplay, "none", StringComparison.CurrentCultureIgnoreCase))
{
SocialDisplay = "none";
}
}
开发者ID:BIGANDYT,项目名称:spitfire-vitality,代码行数:31,代码来源:OwlCarousel.cs
示例7: HandleTalesPath
/// <summary>
/// Gets an <c>System.Object</c> based upon a TALES path fragment.
/// </summary>
/// <remarks>
/// <para>
/// This method should return a <c>System.Object</c> which represents the traversal of a single-level TALES path
/// fragment, from the current instance. The value of that fragment is passed via the name
/// <paramref name="pathFragment"/>.
/// </para>
/// <para>
/// The precise meaning of 'traversal' is left to the implementation, but typical semantics will see an object
/// return an associated object from an object graph.
/// </para>
/// <example>
/// <para>
/// In this simple example, the <c>Employee</c> class may return data from a related <c>Person</c> object, without
/// exposing the Person object directly. This might be because (as shown in this example), the API of that
/// <c>Person</c> object is more complex than desired, and so TALES should see a simplified version.
/// </para>
/// <code>
/// public class Employee : ITalesPathHandler
/// {
/// private Person _person;
///
/// public bool HandleTalesPath(string pathFragment, out object result, RenderingContext currentContext)
/// {
/// switch(pathFragment)
/// {
/// case: "name";
/// result = _person.Name;
/// return true;
/// case: "address";
/// result = _person.Address.FullAddress;
/// return true;
/// case: "gender":
/// result = _person.Gender.ToString();
/// return true;
/// default:
/// result = null;
/// return false;
/// }
/// }
/// }
/// </code>
/// </example>
/// <para>
/// Note that the return value does not need to be a primitive type. It may be a complex object, and the return
/// value may also implement <see cref="ITalesPathHandler"/> if desired.
/// </para>
/// </remarks>
/// <returns><c>true</c> if the path traversal was a success; <c>false</c> otherwise.</returns>
/// <param name="pathFragment">The path fragment.</param>
/// <param name="result">Exposes the result if the traversal was a success</param>
/// <param name="currentContext">Gets the current rendering context.</param>
public override bool HandleTalesPath(string pathFragment, out object result, Rendering.IRenderingContext currentContext)
{
bool output;
object exposedResult;
output = base.HandleTalesPath(pathFragment, out exposedResult, currentContext);
var templateFileInfo = exposedResult as FileInfo;
if(output && templateFileInfo != null)
{
var templateFactory = GetTemplateFactory(currentContext);
RenderingMode mode;
if(templateFactory.TryDetectMode(templateFileInfo, out mode))
{
var doc = templateFactory.CreateTemplateFile(templateFileInfo);
exposedResult = doc;
}
else
{
output = false;
}
}
result = exposedResult;
return output;
}
开发者ID:csf-dev,项目名称:ZPT-Sharp,代码行数:80,代码来源:TemplateDirectory.cs
示例8: Initialize
public virtual void Initialize(Rendering rendering)
{
this.currentRendering = rendering;
MachineName = itemsHelper.GetItemMachineName(rendering.Item);
Id = rendering.Item.ID.ToGuid();
SitecoreFieldNamePrefixAttribute fieldNamePrefixAttribute = this.GetType().GetCustomAttributes<SitecoreFieldNamePrefixAttribute>().FirstOrDefault();
foreach (PropertyInfo pi in GetType().GetProperties())
{
foreach (SitecoreDataAttribute attribute in pi.GetCustomAttributes<SitecoreDataAttribute>())
{
Sitecore.Diagnostics.Profiler.StartOperation(String.Format("Processing {0} for {1}", attribute.GetType().Name, pi.Name));
if (pi.SetMethod == null)
{
throw new Exception(String.Format("No set method for {0}", pi.Name));
}
pi.SetValue(this, attribute.GetValue(fieldNamePrefixAttribute, pi, rendering));
Sitecore.Diagnostics.Profiler.EndOperation(String.Format("Processing {0} for {1}", attribute.GetType().Name, pi.Name));
}
}
}
开发者ID:gnosis,项目名称:sitecore,代码行数:25,代码来源:BaseRenderingModel.cs
示例9: GetRenderer
protected virtual Renderer GetRenderer(Rendering rendering, GetRendererArgs args)
{
var areaRouteData = GetAreaRouteDataFromRenderingItem(rendering.RenderingItem);
var controllerRunner = GetControllerRunner(areaRouteData);
return new AreaControllerRenderer(controllerRunner, areaRouteData);
}
开发者ID:PatriciaPecingina,项目名称:Sitecore-Mvc-Contrib,代码行数:7,代码来源:AreaController.cs
示例10: Render
public Bitmap Render(Rendering.ExecutionOptions options, Action<string> log)
{
try
{
var result = new Bitmap(options.Width, options.Height);
int width = options.Width;
int height = options.Height;
log("Initializing and copying data to GPU memory");
int[,] iterations = new int[height, width];
var dev_iterations = gpu.CopyToDevice(iterations);
var gridSize = new dim3(height, width);
var blockSize = BlockSize;
var minX = (float)options.MinX;
var maxX = (float)options.MaxX;
var minY = (float)options.MinY;
var maxY = (float)options.MaxY;
var stepX = (maxX - minX) / ((float)width);
var stepY = (maxY - minY) / ((float)height);
log("Launching Mandelbrot calculations");
gpu.Launch(gridSize, blockSize, "CalculateMandelbrot", minX, maxY, stepX, stepY, dev_iterations);
log("Mandelbrot calculations done, fetching results from GPU memory");
gpu.CopyFromDevice(dev_iterations, iterations);
log("Generating the final image");
Rendering.fastDrawBitmap(result, iterations);
return result;
}
finally
{
gpu.FreeAll();
}
}
开发者ID:Tsonov,项目名称:FMI.RSA.Mandelbrot,代码行数:34,代码来源:GpuRenderer.cs
示例11: Initialize
/// <summary>
/// Initialize the rendering
/// </summary>
/// <param name="rendering">Rendering to initialize
/// </param>
public override void Initialize(Rendering rendering)
{
base.Initialize(rendering);
Id = rendering.Parameters[ParameterConstants.Id];
SubCssClass = rendering.Parameters[ParameterConstants.Style.SubCssClass];
AnimationClass = rendering.Parameters[ParameterConstants.Style.Animation];
}
开发者ID:BIGANDYT,项目名称:spitfire-vitality,代码行数:12,代码来源:Section.cs
示例12: Initialize
public override void Initialize(Rendering rendering)
{
base.Initialize(rendering);
if (string.IsNullOrEmpty(UrlToLike))
{
UrlToLike = LinkManager.GetItemUrl(DataSourceItem, new UrlOptions { AlwaysIncludeServerUrl = true });
}
}
开发者ID:WeTeam,项目名称:WeBlog,代码行数:8,代码来源:FacebookLike.cs
示例13: GetFromField
protected virtual Type GetFromField(Rendering rendering, GetModelArgs args)
{
Item obj = ObjectExtensions.ValueOrDefault<RenderingItem, Item>(rendering.RenderingItem, (Func<RenderingItem, Item>)(i => i.InnerItem));
if (obj == null)
throw new MapperException("No rendering item");
else
return Type.GetType(obj["Model"], true);
}
开发者ID:RvanDalen,项目名称:Glass.Sitecore.Mapper,代码行数:8,代码来源:GetModel.cs
示例14: GetFromItem
protected virtual object GetFromItem(Rendering rendering, GetModelArgs args)
{
string model = ObjectExtensions.ValueOrDefault<Item, string>(rendering.Item, (Func<Item, string>)(i => i["MvcLayoutModel"]));
if (StringExtensions.IsWhiteSpaceOrNull(model))
return (object) null;
else
return GetObject(model);
}
开发者ID:jelleovermars,项目名称:Glass.Mapper,代码行数:8,代码来源:GetModel.cs
示例15: GetFromPropertyValue
protected virtual object GetFromPropertyValue(Rendering rendering, GetModelArgs args)
{
string model = rendering.Properties["Model"];
if (StringExtensions.IsWhiteSpaceOrNull(model))
return (object)null;
else
return GetObject(model);
}
开发者ID:jelleovermars,项目名称:Glass.Mapper,代码行数:8,代码来源:GetModel.cs
示例16: GetFromField
protected virtual object GetFromField(Rendering rendering, GetModelArgs args)
{
Item obj = ObjectExtensions.ValueOrDefault<RenderingItem, Item>(rendering.RenderingItem, (Func<RenderingItem, Item>)(i => i.InnerItem));
if (obj == null)
return (object)null;
else
return GetObject(obj["Model"]);
}
开发者ID:jelleovermars,项目名称:Glass.Mapper,代码行数:8,代码来源:GetModel.cs
示例17: Initialize
/// <summary>
/// Initialize the Video Model
/// </summary>
/// <param name="rendering">The Rendering to use</param>
public override void Initialize(Rendering rendering)
{
base.Initialize(rendering);
if (rendering.Item != null)
{
VideoPath = MediaManager.GetMediaUrl(rendering.Item);
}
}
开发者ID:BIGANDYT,项目名称:Spitfire,代码行数:12,代码来源:Video.cs
示例18: Initialize
public override void Initialize(Rendering rendering)
{
base.Initialize(rendering);
var currentBlog = ManagerFactory.BlogManagerInstance.GetCurrentBlog();
BlogItem = currentBlog;
Hyperlink = currentBlog.SafeGet(x => x.Url);
Theme = currentBlog.Theme.Item;
}
开发者ID:WeTeam,项目名称:WeBlog,代码行数:8,代码来源:Blog.cs
示例19: Initialize
public void Initialize(Rendering rendering)
{
if (!String.IsNullOrEmpty(rendering.DataSource))
{
Item i = Sitecore.Context.Database.GetItem(rendering.DataSource);
Source = i.Fields["IFrame Link"].Value;
}
}
开发者ID:BIGANDYT,项目名称:paddypower,代码行数:8,代码来源:IFrame.cs
示例20: Get
/// <summary>
/// Gets the specified cart.
/// </summary>
/// <param name="cart">The cart.</param>
/// <param name="rendering">The rendering.</param>
/// <returns>Gets an instance of the CartRenderingModel with initialized Sitecore rendering.</returns>
public static CartRenderingModel Get(CommerceCart cart, Rendering rendering)
{
CartRenderingModel model = new CartRenderingModel(cart);
model.Initialize(rendering);
return model;
}
开发者ID:Brad-Christie,项目名称:sccs-demo,代码行数:14,代码来源:CartRenderingModel.cs
注:本文中的Rendering类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论