⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nameservice.cs

📁 SharpDevelop2.0.0 c#开发免费工具
💻 CS
字号:
//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.1.4322.2032
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------

using System;
using System.Globalization;
using System.ComponentModel;

using SharpReportCore;

/// <summary>
/// Build a proper (unique) Names for all added Item's
/// </summary>
/// <remarks>
/// 	created by - Forstmeier Peter
/// 	created on - 27.08.2005 16:21:50
/// </remarks>
namespace SharpReport {
	public class NameService : System.ComponentModel.Design.Serialization.INameCreationService {
		
		/// <summary>
		/// Default constructor - initializes all fields to default values
		/// </summary>
		public NameService() {
		}
		
		#region Customs implementation
		
		public string CreateName (ReportItemCollection collection,
		                          string typeName) {
			
			string name = Char.ToLower(typeName[0],
			                           CultureInfo.InvariantCulture) + typeName.Substring(1);
			int number = 1;
			
			while (collection.Find(name + number.ToString(CultureInfo.InvariantCulture)) != null) {
				++number;
			}
			
			return name + number.ToString();
		}
		
		
		public bool IsValidName(ReportItemCollection collection,
		                        string name) {
			if (name == null || name.Length == 0 || !(Char.IsLetter(name[0]) || name[0] == '_')) {
				return false;
			}
			IItemRenderer ii= collection.Find(name);
			if (ii != null) {
				return true;
			}
			return false;
		}
		
		public void ValidateName(ReportItemCollection collection,
		                         string name) {
			if (!IsValidName(collection,name)) {
				throw new SharpReportException("Invalid name " + name);
			}
		}
		#endregion
		
		#region System.ComponentModel.Design.Serialization.INameCreationService interface implementation
		public void ValidateName(string name) {
			throw new NotImplementedException("Name Service No Designersupport");
		}
		
		public bool IsValidName(string name) {
			throw new NotImplementedException("Name Service No Designersupport");
		}
		
		
		
		public string CreateName(System.ComponentModel.IContainer container, System.Type dataType) {
			throw new NotImplementedException("Name Service No Designersupport");
		}
		#endregion
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -