• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IResourceResolver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: EmailService

 public EmailService(EmailServiceParams serviceParams, IResourceResolver resourceResolver)
 {
     if (serviceParams.FromAddress.Clear() == null)
     {
         throw new Exception("From address cannot be null or empty");
     }
     if (serviceParams.SmtpAddress.Clear() == null || serviceParams.SmtpPort == 0)
     {
         throw new Exception("Invalid SMTP server configuration");
     }
     ServiceParams = serviceParams;
     From = ExtensionsLocal.GetMailAddress(serviceParams.FromAddress, serviceParams.FromDisplayName);
     Sender = ExtensionsLocal.GetMailAddress(serviceParams.SenderAddress, serviceParams.SenderDisplayName) ?? From;
     UseAuthentication = false;
     ResourceResolver = resourceResolver;
 }
开发者ID:BikS2013,项目名称:bUtility,代码行数:16,代码来源:EmailService.cs


示例17: CrudActionModel

		/// <summary>
		/// Constructor that allows specifying which of Add, Edit, and Delete actions should appear.
		/// </summary>
		/// <param name="add"></param>
		/// <param name="edit"></param>
		/// <param name="delete"></param>
		/// <param name="fallBackResolver"></param>
		public CrudActionModel(bool add, bool edit, bool delete, IResourceResolver fallBackResolver)
			: base(new ApplicationThemeResourceResolver(typeof(CrudActionModel).Assembly, fallBackResolver))
		{
			if (add)
			{
				this.AddAction(AddKey, SR.TitleAdd, IconAddResource);
			}
			if (edit)
			{
				this.AddAction(EditKey, SR.TitleEdit, IconEditResource);
			}
			if (delete)
			{
				this.AddAction(DeleteKey, SR.TitleDelete, IconDeleteResource);
			}
		}
开发者ID:nhannd,项目名称:Xian,代码行数:23,代码来源:CrudActionModel.cs


示例18: ServerSerializationContextProvider

 public ServerSerializationContextProvider(ITypeResolver typeMapper,
                                           IUriResolver uriResolver,
                                           IResourceResolver resourceResolver,
                                           IContainer container)
 {
     if (typeMapper == null)
         throw new ArgumentNullException(nameof(typeMapper));
     if (uriResolver == null)
         throw new ArgumentNullException(nameof(uriResolver));
     if (resourceResolver == null)
         throw new ArgumentNullException(nameof(resourceResolver));
     if (container == null)
         throw new ArgumentNullException(nameof(container));
     this.typeMapper = typeMapper;
     this.uriResolver = uriResolver;
     this.resourceResolver = resourceResolver;
     this.container = container;
 }
开发者ID:Pomona,项目名称:Pomona,代码行数:18,代码来源:ServerSerializationContextProvider.cs


示例19: CreateIcon

		public override Image CreateIcon(IconSize iconSize, IResourceResolver resourceResolver)
		{
			//TODO: make unsafe. Not enabling unsafe code just for this, though.
			var bitmap = (Bitmap) base.CreateIcon(iconSize, resourceResolver);
			for (int x = 0; x < bitmap.Width; ++x)
			{
				for (int y = 0; y < bitmap.Height; ++y)
				{
					var pixel = bitmap.GetPixel(x, y);
					int gray = (int) (pixel.R*0.3f + pixel.G*0.59F + pixel.B*0.11f);
					if (gray > 255)
						gray = 255;

					bitmap.SetPixel(x, y, Color.FromArgb(pixel.A, gray, gray, gray));
				}
			}
			return bitmap;
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:18,代码来源:GrayscaleIconSet.cs


示例20: FlashOverlayController

		/// <summary>
		/// Constructs a controller that uses the 32-bit colour ARGB bitmap specified by the resource name and resource resolver.
		/// </summary>
		/// <param name="resourceName">The partially or fully qualified name of the resource to access.</param>
		/// <param name="resourceResolver">A resource resolver for the resource.</param>
		public FlashOverlayController(string resourceName, IResourceResolver resourceResolver) : this()
		{
			using (Bitmap bitmap = new Bitmap(resourceResolver.OpenResource(resourceName)))
			{
				BitmapData data = bitmap.LockBits(new Rectangle(Point.Empty, bitmap.Size), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
				try
				{
					int length = data.Stride*data.Height;
					_pixelData = new byte[length];
					_rows = data.Height;
					_columns = data.Width;
					Marshal.Copy(data.Scan0, _pixelData, 0, length);
				}
				finally
				{
					bitmap.UnlockBits(data);
				}
			}
		}
开发者ID:nhannd,项目名称:Xian,代码行数:24,代码来源:FlashOverlayController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IResourceService类代码示例发布时间:2022-05-24
下一篇:
C# IResourceManager类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap