当前位置: 首页>>代码示例>>C#>>正文


C# IResourceResolver类代码示例

本文整理汇总了C#中IResourceResolver的典型用法代码示例。如果您正苦于以下问题:C# IResourceResolver类的具体用法?C# IResourceResolver怎么用?C# IResourceResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IResourceResolver类属于命名空间,在下文中一共展示了IResourceResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddAttachments

 public static MailMessage AddAttachments(this MailMessage mail, List<string> attachments, IResourceResolver resourceResolver)
 {
     if (mail != null && attachments != null && attachments.Any())
     {
         if (resourceResolver == null)
         {
             throw new Exception("ResourceResolver not set");
         }
         attachments.ForEach(a =>
         {
             MailAttachment att = resourceResolver.GetMailAttachment(a);
             if (att != null)
             {
                 MemoryStream ms = new MemoryStream(att.Content);
                 if (att.MediaType.Clear() != null)
                 {
                     mail.Attachments.Add(new Attachment(ms, att.Name, att.MediaType));
                 }
                 else
                 {
                     mail.Attachments.Add(new Attachment(ms, att.Name));
                 }
             }
         });
     }
     return mail;
 }
开发者ID:BikS2013,项目名称:bUtility,代码行数:27,代码来源:ExtensionsLocal.cs

示例2: AddHtmlView

 public static MailMessage AddHtmlView(this MailMessage mail, string htmlBody, List<string> resources, IResourceResolver resourceResolver)
 {
     if (mail != null && htmlBody.Clear() != null && resources != null && resources.Any())
     {
         if (resourceResolver == null)
         {
             throw new Exception("ResourceResolver not set");
         }
         AlternateView av = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);
         resources.ForEach(r =>
         {
             HtmlResource hr = resourceResolver.GetHtmlResource(r);
             if (hr != null)
             {
                 MemoryStream ms = new MemoryStream(hr.Content);
                 LinkedResource lr;
                 if (hr.MediaType.Clear() != null)
                 {
                     lr = new LinkedResource(ms, hr.MediaType.Clear());
                 }
                 else
                 {
                     lr = new LinkedResource(ms);
                 }
                 lr.ContentId = hr.ContentId;
                 av.LinkedResources.Add(lr);
             }
             mail.AlternateViews.Add(av);
         });
     }
     return mail;
 }
开发者ID:BikS2013,项目名称:bUtility,代码行数:32,代码来源:ExtensionsLocal.cs

示例3: CreateView

        protected override IView CreateView(VirtualPath pathToView, IResourceResolver resolver)
        {
            var resource = resolver.GetResource(pathToView);
            if (resource == null || !resource.IsFile) {
                return null;
            }

            return new NustacheView(this, pathToView, resource, resolver);
        }
开发者ID:jammycakes,项目名称:dolstagis.web,代码行数:9,代码来源:NustacheViewEngine.cs

示例4: FromEmbeddedResource

		/// <summary>
		/// Instantiates an active template from an embedded resource.
		/// </summary>
		/// <param name="resource"></param>
		/// <param name="resolver"></param>
		/// <returns></returns>
		public static ActiveTemplate FromEmbeddedResource(string resource, IResourceResolver resolver)
		{
			using (var stream = resolver.OpenResource(resource))
			{
				using (var reader = new StreamReader(stream))
				{
					return new ActiveTemplate(reader);
				}
			}
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:16,代码来源:ActiveTemplate.cs

示例5: DotLiquidView

 public DotLiquidView(VirtualPath path, IResource resource, IResourceResolver resolver)
 {
     _path = path;
     _resolver = resolver;
     using (var stream = resource.Open())
     using (var reader = new StreamReader(stream)) {
         string tpl = reader.ReadToEnd();
         _template = Template.Parse(tpl);
     }
 }
开发者ID:jammycakes,项目名称:dolstagis.web,代码行数:10,代码来源:DotLiquidView.cs

示例6: AnnotationItem

		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="identifier">The unique identifier of the <see cref="AnnotationItem"/>.</param>
		/// <param name="displayName">The <see cref="AnnotationItem"/>'s display name.</param>
		/// <param name="label">The <see cref="AnnotationItem"/>'s label.</param>
		/// <param name="resourceResolver">The object that will resolve the display name and label parameters as the keys representing localized strings.</param>
		protected AnnotationItem(string identifier, string displayName, string label, IResourceResolver resourceResolver)
		{
			Platform.CheckForEmptyString(identifier, "identifier");
			Platform.CheckForEmptyString(displayName, "displayName");

			_standardResourceResolver = resourceResolver ?? new ResourceResolver(GetType(), false);
			_identifier = identifier;
			_displayName = displayName;
			_label = label ?? "";
		}
开发者ID:nhannd,项目名称:Xian,代码行数:17,代码来源:AnnotationItem.cs

示例7: NustacheView

 public NustacheView(NustacheViewEngine engine, VirtualPath path, IResource resource, IResourceResolver resolver)
 {
     _engine = engine;
     _path = path;
     _resolver = resolver;
     using (var stream = resource.Open())
     using (var reader = new StreamReader(stream)) {
         Template = new Template();
         Template.Load(reader);
     }
 }
开发者ID:jammycakes,项目名称:dolstagis.web,代码行数:11,代码来源:NustacheView.cs

示例8: StackTabPage

		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="name">The name of the page.</param>
		/// <param name="component">The <see cref="IApplicationComponent"/> to be hosted in this page.</param>
		/// <param name="title">The text to display on the title bar.</param>
		/// <param name="iconSet">The icon to display on the title bar.</param>
		/// <param name="fallbackResolver">Resource resolver to fall back on in case the default failed to find resources.</param>
		public StackTabPage(string name, 
			IApplicationComponent component, 
			string title, 
			IconSet iconSet,
			IResourceResolver fallbackResolver)
			: base(name, component)
		{
			_title = title;
			_iconSet = iconSet;
			_resourceResolver = new ApplicationThemeResourceResolver(typeof(StackTabPage).Assembly, fallbackResolver);
		}
开发者ID:nhannd,项目名称:Xian,代码行数:19,代码来源:StackTabPage.cs

示例9: ServerSerializationContextProvider

 public ServerSerializationContextProvider(IUriResolver uriResolver, IResourceResolver resourceResolver, NancyContext nancyContext)
 {
     if (uriResolver == null)
         throw new ArgumentNullException("uriResolver");
     if (resourceResolver == null)
         throw new ArgumentNullException("resourceResolver");
     if (nancyContext == null)
         throw new ArgumentNullException("nancyContext");
     this.uriResolver = uriResolver;
     this.resourceResolver = resourceResolver;
     this.nancyContext = nancyContext;
 }
开发者ID:BeeWarloc,项目名称:Pomona,代码行数:12,代码来源:ServerSerializationContextProvider.cs

示例10: CreateAction

		private IAction CreateAction(TransferSyntax syntax, IResourceResolver resolver)
		{
		    var action = new ClickAction(syntax.UidString,
		                                 new ActionPath("dicomstudybrowser-contextmenu/Change Transfer Syntax/" + syntax.ToString(), resolver),
		                                 ClickActionFlags.None, resolver) {Enabled = Enabled};

		    this.EnabledChanged += (sender, args) => action.Enabled = Enabled;

            action.SetClickHandler(() => ChangeToSyntax(syntax));
			action.Label = syntax.ToString();
			return action;
		}
开发者ID:bigbluebutton86,项目名称:ClearCanvas,代码行数:12,代码来源:ChangeTransferSyntaxTool.cs

示例11: CreateIcon

		public override Image CreateIcon(IconSize iconSize, IResourceResolver resourceResolver)
		{
			var bitmap = new Bitmap(_dimensions.Width, _dimensions.Height);
			using(var g = System.Drawing.Graphics.FromImage(bitmap))
			{
				g.FillRectangle(Brushes.White, 0, 0, _dimensions.Width - 1, _dimensions.Height - 1);
				g.DrawRectangle(Pens.DarkGray, 0, 0, _dimensions.Width - 1, _dimensions.Height - 1);
				g.FillRectangle(GetBrush(), 1, 1,
					Math.Min((int)(_dimensions.Width*_percent/100), _dimensions.Width - 2),
					_dimensions.Height - 2);
			}
			return bitmap;
		}
开发者ID:nhannd,项目名称:Xian,代码行数:13,代码来源:ProgressBarIconSet.cs

示例12: CreateIcon

		/// <summary>
		/// Creates an icon using the specified icon resource and resource resolver.
		/// </summary>
		/// <param name="iconSize">The size of the desired icon.</param>
		/// <param name="resourceResolver">The resource resolver with which to resolve the requested icon resource.</param>
		/// <returns>An <see cref="Image"/> constructed from the requested resource.</returns>
		/// <exception cref="ArgumentNullException">Thrown if <paramref name="resourceResolver"/> is null.</exception>
		/// <exception cref="ArgumentException">Thrown if <paramref name="resourceResolver"/> was unable to resolve the requested icon resource.</exception>
		public override Image CreateIcon(IconSize iconSize, IResourceResolver resourceResolver)
		{
			var iconBase = base.CreateIcon(iconSize, resourceResolver);
			var iconOverlay = GetOverlayIcon(iconSize);
			if (iconOverlay != null)
			{
				using (var g = Graphics.FromImage(iconBase))
				{
					g.DrawImageUnscaledAndClipped(iconOverlay, new Rectangle(Point.Empty, iconBase.Size));
				}
				iconOverlay.Dispose();
			}
			return iconBase;
		}
开发者ID:nhannd,项目名称:Xian,代码行数:22,代码来源:UnavailableActionIconSet.cs

示例13: GetView

        public IView GetView(VirtualPath pathToView, IResourceResolver resolver)
        {
            if (_settings.Debug)
            {
                return CreateView(pathToView, resolver);
            }

            IView result = null;
            string key = pathToView.Path;
            if (!_cache.TryGetValue(key, out result)) {
                result = CreateView(pathToView, resolver);
                _cache[key] = result;
            }
            return result;
        }
开发者ID:jammycakes,项目名称:dolstagis.web,代码行数:15,代码来源:ViewEngineBase.cs

示例14: Action

		/// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="actionID">The logical action ID.</param>
        /// <param name="path">The action path.</param>
        /// <param name="resourceResolver">A resource resolver that will be used to resolve icons associated with this action.</param>
        protected Action(string actionID, ActionPath path, IResourceResolver resourceResolver)
        {
            _actionID = actionID;
            _path = path;
            _resourceResolver = resourceResolver;

            // smart defaults
            _enabled = true;
            _visible = true;
			_available = true;

			_persistent = false;

            FormerActionIDs = new List<string>();
        }
开发者ID:nhannd,项目名称:Xian,代码行数:21,代码来源:Action.cs

示例15: AbstractAction

		private AbstractAction(string id, string path, IResourceResolver resourceResolver)
		{
			Platform.CheckForEmptyString(id, "id");
			Platform.CheckForEmptyString(path, "path");

			_resourceResolver = resourceResolver;
			_actionId = id;
            _formerActionIds = new List<string>();
			_path = new ActionPath(path, resourceResolver);
			_groupHint = new GroupHint(string.Empty);
			_label = string.Empty;
			_tooltip = string.Empty;
			_iconSet = null;
			_available = true;
			_permissible = false;
		}
开发者ID:nhannd,项目名称:Xian,代码行数:16,代码来源:AbstractAction.cs


注:本文中的IResourceResolver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。