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


C# Generator.Cache方法代码示例

本文整理汇总了C#中Generator.Cache方法的典型用法代码示例。如果您正苦于以下问题:C# Generator.Cache方法的具体用法?C# Generator.Cache怎么用?C# Generator.Cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Generator的用法示例。


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

示例1: ClearCache

		/// <summary>
		/// Clears the brush cache
		/// </summary>
		/// <remarks>
		/// This is useful if you are using the <see cref="Cached"/> method to cache brushes and want to clear it
		/// to conserve memory or resources.
		/// </remarks>
		/// <param name="generator">Generator to clear the brush cache for</param>
		public static void ClearCache (Generator generator = null)
		{
			var cache = generator.Cache<BrushKey, SolidBrush>(cacheKey);
			lock (cache) {
				cache.Clear ();
			}
		}
开发者ID:Exe0,项目名称:Eto,代码行数:15,代码来源:Brushes.cs

示例2: ClearCache

		/// <summary>
		/// Clears the pen cache
		/// </summary>
		/// <remarks>
		/// This is useful if you are using the <see cref="Cached"/> method to cache pens and want to clear it
		/// to conserve memory or resources.
		/// </remarks>
		/// <param name="generator">Generator to clear the pen cache for</param>
		public static void ClearCache (Generator generator = null)
		{
			var cache = generator.Cache<PenKey, Pen> (cacheKey);
			lock (cache) {
				cache.Clear ();
			}
		}
开发者ID:alexandrebaker,项目名称:Eto,代码行数:15,代码来源:Pens.cs

示例3: ClearCache

		/// <summary>
		/// Clears the cursor cache
		/// </summary>
		/// <remarks>
		/// This is useful if you are using the <see cref="Cached"/> method to cache pens and want to clear it
		/// to conserve memory or resources.
		/// </remarks>
		/// <param name="generator">Generator to clear the pen cache for</param>
		public static void ClearCache (Generator generator = null)
		{
			var cache = generator.Cache<CursorType, Cursor> (cursorCache);
			lock (cache) {
				cache.Clear ();
			}
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:15,代码来源:Cursors.cs

示例4: GetCursor

		static Cursor GetCursor (CursorType type, Generator generator = null)
		{
			var cache = generator.Cache<CursorType, Cursor> (cursorCache);
			Cursor cursor;
			lock (cache) {
				if (!cache.TryGetValue (type, out cursor)) {
					cursor = new Cursor (generator, type);
					cache [type] = cursor;
				}
			}
			return cursor;
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:12,代码来源:Cursors.cs

示例5: GetFont

		static Font GetFont (FontFamily family, float size, FontStyle style, Generator generator)
		{
			var cache = generator.Cache<FontCacheKey, Font>(cacheKey);
			Font font;
			lock (cache) {
				var key = new FontCacheKey (family, size, style);
				if (!cache.TryGetValue (key, out font)) {
					font = new Font (family, size, style, generator);
					cache.Add (key, font);
				}
			}
			return font;
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:13,代码来源:Fonts.cs

示例6: GetBrush

		static Brush GetBrush (Color color, Generator generator)
		{
			var cache = generator.Cache<BrushKey, Brush>(cacheKey);
			Brush brush;
			lock (cache) {
				var key = new BrushKey (color.ToArgb ());
				if (!cache.TryGetValue (key, out brush)) {
					brush = new SolidBrush (color, generator);
					cache.Add (key, brush);
				}
			}
			return brush;
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:13,代码来源:Brushes.cs

示例7: GetPen

		static Pen GetPen (Generator generator, Color color, float thickness = 1f, DashStyle dashStyle = null)
		{
			var cache = generator.Cache<PenKey, Pen> (cacheKey);
			Pen pen;
			lock (cache) {
				var key = new PenKey (color.ToArgb (), thickness, dashStyle);
				if (!cache.TryGetValue (key, out pen)) {
					pen = new Pen (color, thickness, generator);
					if (dashStyle != null) pen.DashStyle = dashStyle;
					cache.Add (key, pen);
				}
			}
			return pen;
		}
开发者ID:alexandrebaker,项目名称:Eto,代码行数:14,代码来源:Pens.cs

示例8: GetFont

		static Font GetFont(SystemFont systemFont, float? size, FontDecoration decoration, Generator generator)
		{
			var cache = generator.Cache<FontCacheKey, Font>(cacheKey);
			Font font;
			lock (cache)
			{
				var key = new FontCacheKey(systemFont, size, decoration);
				if (!cache.TryGetValue(key, out font))
				{
					font = new Font(systemFont, size, decoration, generator);
					cache.Add(key, font);
				}
			}
			return font;
		}
开发者ID:Exe0,项目名称:Eto,代码行数:15,代码来源:SystemFonts.cs

示例9: ClearCache

		public static void ClearCache (Generator generator)
		{
			var cache = generator.Cache<FontCacheKey, Font>(cacheKey);
			lock (cache) {
				cache.Clear ();
			}
		}
开发者ID:gene-l-thomas,项目名称:Eto,代码行数:7,代码来源:Fonts.cs


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