本文整理汇总了C#中IDesignerHost.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# IDesignerHost.GetHashCode方法的具体用法?C# IDesignerHost.GetHashCode怎么用?C# IDesignerHost.GetHashCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDesignerHost
的用法示例。
在下文中一共展示了IDesignerHost.GetHashCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveCreator
public void RemoveCreator(string format, IDesignerHost host)
{
if (format == null)
throw new ArgumentNullException("format");
if (customCreators != null)
{
string key = format;
if (host != null)
key += ", " + host.GetHashCode().ToString();
customCreators.Remove(key);
}
}
示例2: FindToolboxItemCreator
private ToolboxItemCreatorCallback FindToolboxItemCreator(IDataObject dataObj, IDesignerHost host, out string foundFormat)
{
foundFormat = string.Empty;
ToolboxItemCreatorCallback creator = null;
if (customCreators != null)
{
IEnumerator keys = customCreators.Keys.GetEnumerator();
while (keys.MoveNext())
{
string key = (string)keys.Current;
string[] keyParts = key.Split(new char[] { ',' });
string format = keyParts[0];
if (dataObj.GetDataPresent(format))
{
if (keyParts.Length == 1 || (host != null && host.GetHashCode().ToString().Equals(keyParts[1])))
{
creator = (ToolboxItemCreatorCallback)customCreators[format];
foundFormat = format;
break;
}
}
}
}
return creator;
}
示例3: AddCreator
public void AddCreator(ToolboxItemCreatorCallback creator, string format, IDesignerHost host)
{
if (creator == null || format == null)
{
throw new ArgumentNullException(creator == null ? "creator" : "format");
}
if (customCreators == null)
{
customCreators = new Hashtable();
}
else
{
string key = format;
if (host != null) key += ", " + host.GetHashCode().ToString();
if (customCreators.ContainsKey(key))
{
throw new Exception("There is already a creator registered for the format '" + format + "'.");
}
}
customCreators[format] = creator;
}