本文整理汇总了C#中IExtenderProvider类的典型用法代码示例。如果您正苦于以下问题:C# IExtenderProvider类的具体用法?C# IExtenderProvider怎么用?C# IExtenderProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IExtenderProvider类属于命名空间,在下文中一共展示了IExtenderProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RegisterExtenderProvider
public int RegisterExtenderProvider(IExtenderProvider extenderProvider)
{
int cookie = this.lastCookie + 1;
this.extenderProviders.Add(cookie, extenderProvider);
this.lastCookie = cookie;
return cookie;
}
开发者ID:icool123,项目名称:T4Toolbox,代码行数:7,代码来源:FakeObjectExtenders.cs
示例2: RemoveExtenderProvider
public void RemoveExtenderProvider (IExtenderProvider provider)
{
if (_extenderProviders != null) {
if (_extenderProviders.Contains (provider))
_extenderProviders.Remove (provider);
}
}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:ExtenderService.cs
示例3: Create
/// <devdoc>
/// Creates a new ExtenderProvidedPropertyAttribute.
/// </devdoc>
internal static ExtenderProvidedPropertyAttribute Create(PropertyDescriptor extenderProperty, Type receiverType, IExtenderProvider provider) {
ExtenderProvidedPropertyAttribute e = new ExtenderProvidedPropertyAttribute();
e.extenderProperty = extenderProperty;
e.receiverType = receiverType;
e.provider = provider;
return e;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:10,代码来源:ExtenderProvidedPropertyAttribute.cs
示例4: AddExtenderProvider
public void AddExtenderProvider (IExtenderProvider provider)
{
if (_extenderProviders != null) {
if (!_extenderProviders.Contains (provider))
_extenderProviders.Add (provider);
}
}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:ExtenderService.cs
示例5:
internal ExtenderProvidedPropertyAttribute
(PropertyDescriptor extenderProperty,
IExtenderProvider provider, Type receiverType)
{
this.extenderProperty = extenderProperty;
this.provider = provider;
this.receiverType = receiverType;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:ExtenderProvidedPropertyAttribute.cs
示例6: CreateAttribute
// Call this method to create a ExtenderProvidedPropertyAttribute and set it's values
internal static ExtenderProvidedPropertyAttribute CreateAttribute (PropertyDescriptor extenderProperty, IExtenderProvider provider, Type receiverType)
{
ExtenderProvidedPropertyAttribute NewAttribute = new ExtenderProvidedPropertyAttribute();
NewAttribute.extender = extenderProperty;
NewAttribute.receiver = receiverType;
NewAttribute.extenderProvider = provider;
return NewAttribute;
}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:ExtenderProvidedPropertyAttribute.cs
示例7:
IExtenderProvider[] IExtenderListService.GetExtenderProviders()
{
if (this._providers != null)
{
IExtenderProvider[] array = new IExtenderProvider[this._providers.Count];
this._providers.CopyTo(array, 0);
return array;
}
return new IExtenderProvider[0];
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:ExtenderProviderService.cs
示例8: GetExtenderProviders
public IExtenderProvider[] GetExtenderProviders()
{
if (_extenderProviders != null) {
IExtenderProvider[] result = new IExtenderProvider[_extenderProviders.Count];
_extenderProviders.CopyTo (result, 0);
return result;
}
return null;
}
开发者ID:Profit0004,项目名称:mono,代码行数:10,代码来源:ExtenderService.cs
示例9: ArgumentNullException
void IExtenderProviderService.RemoveExtenderProvider(IExtenderProvider provider)
{
if (provider == null)
{
throw new ArgumentNullException("provider");
}
if (this._providers != null)
{
this._providers.Remove(provider);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:ExtenderProviderService.cs
示例10: DebugExtendedPropertyDescriptor
/// <devdoc>
/// Creates a new extended property info. Callers can then treat this as
/// a standard property.
/// </devdoc>
public DebugExtendedPropertyDescriptor(DebugReflectPropertyDescriptor extenderInfo, Type receiverType, IExtenderProvider provider, Attribute[] attributes)
: base(extenderInfo, attributes) {
Debug.Assert(extenderInfo != null, "DebugExtendedPropertyDescriptor must have extenderInfo");
Debug.Assert(provider != null, "DebugExtendedPropertyDescriptor must have provider");
ArrayList attrList = new ArrayList(AttributeArray);
attrList.Add(ExtenderProvidedPropertyAttribute.Create(extenderInfo, receiverType, provider));
if (extenderInfo.IsReadOnly) {
attrList.Add(ReadOnlyAttribute.Yes);
}
Attribute[] temp = new Attribute[attrList.Count];
attrList.CopyTo(temp, 0);
AttributeArray = temp;
this.extenderInfo = extenderInfo;
this.provider = provider;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:23,代码来源:DebugExtendedPropertyDescriptor.cs
示例11: ExtenderShouldSerializeValue
internal bool ExtenderShouldSerializeValue(IExtenderProvider provider, object component) {
provider = (IExtenderProvider)GetDebugInvokee(componentClass, provider);
if (IsReadOnly) {
if (ShouldSerializeMethodValue != null) {
try {
return (bool)ShouldSerializeMethodValue.Invoke(provider, new object[] {component});
}
catch {}
}
return Attributes.Contains(DesignerSerializationVisibilityAttribute.Content);
}
else if (DefaultValue == noValue) {
if (ShouldSerializeMethodValue != null) {
try {
return (bool)ShouldSerializeMethodValue.Invoke(provider, new object[] {component});
}
catch {}
}
return true;
}
return !object.Equals(DefaultValue, ExtenderGetValue(provider, component));
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:25,代码来源:DebugReflectPropertyDescriptor.cs
示例12: ExtenderSetValue
internal void ExtenderSetValue(IExtenderProvider provider, object component, object value, PropertyDescriptor notifyDesc) {
if (provider != null) {
ISite site = GetSite(component);
IComponentChangeService changeService = null;
object oldValue = null;
// Announce that we are about to change this component
//
if (site != null) {
changeService = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
Debug.Assert(!CompModSwitches.CommonDesignerServices.Enabled || changeService != null, "IComponentChangeService not found");
}
// Make sure that it is ok to send the onchange events
//
if (changeService != null) {
oldValue = ExtenderGetValue(provider, component);
try {
changeService.OnComponentChanging(component, notifyDesc);
}
catch (CheckoutException coEx) {
if (coEx == CheckoutException.Canceled) {
return;
}
throw coEx;
}
}
provider = (IExtenderProvider)GetDebugInvokee(componentClass, provider);
if (SetMethodValue != null) {
SetMethodValue.Invoke(provider, new object[] { component, value});
// Now notify the change service that the change was successful.
//
if (changeService != null) {
changeService.OnComponentChanged(component, notifyDesc, oldValue, value);
}
}
}
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:42,代码来源:DebugReflectPropertyDescriptor.cs
示例13: ExtenderGetValue
internal object ExtenderGetValue(IExtenderProvider provider, object component) {
if (provider != null) {
provider = (IExtenderProvider)GetDebugInvokee(componentClass, provider);
return GetMethodValue.Invoke(provider, new object[] { component});
}
return null;
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:7,代码来源:DebugReflectPropertyDescriptor.cs
示例14: ExtenderGetType
internal Type ExtenderGetType(IExtenderProvider provider) {
return PropertyType;
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:3,代码来源:DebugReflectPropertyDescriptor.cs
示例15: ExtenderCanResetValue
internal bool ExtenderCanResetValue(IExtenderProvider provider, object component) {
if (DefaultValue != noValue) {
return !object.Equals(ExtenderGetValue(provider, component),defaultValue);
}
MethodInfo reset = ResetMethodValue;
if (reset != null) {
MethodInfo shouldSerialize = ShouldSerializeMethodValue;
if (shouldSerialize != null) {
try {
provider = (IExtenderProvider)GetDebugInvokee(componentClass, provider);
return (bool)shouldSerialize.Invoke(provider, new object[] { component});
}
catch {}
}
}
else {
return true;
}
return false;
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:21,代码来源:DebugReflectPropertyDescriptor.cs
示例16: ExtendersMatch
// This will return true if the given array if extenders is the same
// as the set that these stashed properties were created with.
//
public bool ExtendersMatch(IExtenderProvider[] providers, object instance) {
long hash = HashExtenders(providers, instance);
return extenderHash == hash;
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:7,代码来源:DebugTypeDescriptor.cs
示例17: GetExtenderProviders
/// <devdoc>
/// Retrieves the set of extender providers providing services for the given component.
/// </devdoc>
private IExtenderProvider[] GetExtenderProviders(ISite site) {
// See if this component's site has an IExtenderListService. If it
// does, we get our list of extenders from that, not from the container.
//
IExtenderListService listService = (IExtenderListService)site.GetService(typeof(IExtenderListService));
if (listService != null) {
return listService.GetExtenderProviders();
}
else {
ComponentCollection comps = site.Container.Components;
ArrayList exList = null;
foreach(IComponent comp in comps) {
if (comp is IExtenderProvider) {
if (exList == null) {
exList = new ArrayList(2);
}
exList.Add(comp);
}
}
if (exList == null) {
return null;
}
else {
IExtenderProvider[] temp = new IExtenderProvider[exList.Count];
exList.CopyTo(temp, 0);
return temp;
}
}
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:33,代码来源:DebugTypeDescriptor.cs
示例18: ReflectGetExtendedProperties
/// <devdoc>
/// This performs the actual reflection needed to discover
/// extender properties. If object caching is supported this
/// will maintain a cache of property descriptors on the
/// extender provider. Extender properties are actually two
/// property descriptors in one. There is a chunk of per-class
/// data in a ReflectPropertyDescriptor that defines the
/// parameter types and get and set methods of the extended property,
/// and there is an ExtendedPropertyDescriptor that combines this
/// with an extender provider object to create what looks like a
/// normal property. ReflectGetExtendedProperties maintains two
/// separate caches for these two sets: a static one for the
/// ReflectPropertyDescriptor values that don't change for each
/// provider instance, and a per-provider cache that contains
/// the ExtendedPropertyDescriptors.
/// </devdoc>
private static PropertyDescriptor[] ReflectGetExtendedProperties(IExtenderProvider provider)
{
IDictionary cache = TypeDescriptor.GetCache(provider);
PropertyDescriptor[] properties;
if (cache != null)
{
properties = cache[_extenderProviderPropertiesKey] as PropertyDescriptor[];
if (properties != null)
{
return properties;
}
}
// Our per-instance cache missed. We have never seen this instance of the
// extender provider before. See if we can find our class-based
// property store.
//
if (_extendedPropertyCache == null)
{
lock (_internalSyncObject)
{
if (_extendedPropertyCache == null)
{
_extendedPropertyCache = new Hashtable();
}
}
}
Type providerType = provider.GetType();
ReflectPropertyDescriptor[] extendedProperties = (ReflectPropertyDescriptor[])_extendedPropertyCache[providerType];
if (extendedProperties == null)
{
lock (_internalSyncObject)
{
extendedProperties = (ReflectPropertyDescriptor[])_extendedPropertyCache[providerType];
// Our class-based property store failed as well, so we need to build up the set of
// extended properties here.
//
if (extendedProperties == null)
{
AttributeCollection attributes = TypeDescriptor.GetAttributes(providerType);
ArrayList extendedList = new ArrayList(attributes.Count);
foreach(Attribute attr in attributes)
{
ProvidePropertyAttribute provideAttr = attr as ProvidePropertyAttribute;
if (provideAttr != null)
{
Type receiverType = GetTypeFromName(provideAttr.ReceiverTypeName);
if (receiverType != null)
{
MethodInfo getMethod = providerType.GetMethod("Get" + provideAttr.PropertyName, new Type[] {receiverType});
if (getMethod != null && !getMethod.IsStatic && getMethod.IsPublic)
{
MethodInfo setMethod = providerType.GetMethod("Set" + provideAttr.PropertyName, new Type[] {receiverType, getMethod.ReturnType});
if (setMethod != null && (setMethod.IsStatic || !setMethod.IsPublic))
{
setMethod = null;
}
extendedList.Add(new ReflectPropertyDescriptor(providerType, provideAttr.PropertyName, getMethod.ReturnType, receiverType, getMethod, setMethod, null));
}
}
}
}
extendedProperties = new ReflectPropertyDescriptor[extendedList.Count];
extendedList.CopyTo(extendedProperties, 0);
_extendedPropertyCache[providerType] = extendedProperties;
}
}
}
// Now that we have our extended properties we can build up a list of callable properties. These can be
// returned to the user.
//
properties = new PropertyDescriptor[extendedProperties.Length];
for (int idx = 0; idx < extendedProperties.Length; idx++)
//.........这里部分代码省略.........
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:101,代码来源:ReflectTypeDescriptionProvider.cs
示例19: GetWrappedExtenders
/// <devdoc>
/// Retrieves filtered, wrapped extended properties based on the provider and the extenderInfos for this type of provider.
/// These are the extended properties that will be handed out to components through
/// getExtendedProperties and getMergedProperties. These are wrapped versions of what is returned
/// through getExtenders. They are filtered based on the attributes. They are sorted
/// based on the sort property.
/// </devdoc>
private IList GetWrappedExtenders(IExtenderProvider provider) {
Debug.WriteLineIf(CompDescrSwitch.TraceVerbose, "GetWrappedExtenders");
if (wrappedExtenderTable == null) {
wrappedExtenderTable = new Hashtable();
}
if (provider == null) {
return null;
}
Type providerType = ((object)provider).GetType();
if (!componentType.IsAssignableFrom(providerType)) {
throw new ArgumentException(SR.GetString(SR.ErrorBadExtenderType, providerType.Name, componentType.Name), "provider");
}
bool sitedProvider = false;
if (provider is IComponent && ((IComponent)provider).Site != null) {
sitedProvider = true;
}
IList wrappedExtenders = null;
lock(this) {
wrappedExtenders = (IList) wrappedExtenderTable[provider];
if (wrappedExtenders == null) {
Debug.WriteLineIf(CompDescrSwitch.TraceVerbose, "\tentry not found in table... creating");
IList extenders = GetExtenders();
Debug.WriteLineIf(CompDescrSwitch.TraceVerbose, "\tfound " + extenders.Count.ToString(CultureInfo.InvariantCulture) + " extenders");
wrappedExtenders = new ArrayList(extenders.Count);
for (int i = 0; i < extenders.Count; i++) {
DebugReflectPropertyDescriptor ex = (DebugReflectPropertyDescriptor)extenders[i];
Attribute[] attrs = null;
// If the extender provider is not a sited component, then mark all
// of its properties as design time only, since there is no way we
// can persist them. We can assume this because this is only called if
// we could get the extender provider list from a component site.
//
if (!sitedProvider) {
attrs = new Attribute[] {DesignOnlyAttribute.Yes};
}
wrappedExtenders.Add(new DebugExtendedPropertyDescriptor(ex, ex.ExtenderGetReceiverType(), provider, attrs));
}
wrappedExtenderTable[provider] = wrappedExtenders;
}
else {
Debug.WriteLineIf(CompDescrSwitch.TraceVerbose, "\tentry found in table...");
}
}
return wrappedExtenders;
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:62,代码来源:DebugTypeDescriptor.cs
示例20:
int ObjectExtenders.RegisterExtenderProvider(string extenderCategory, string extenderName, IExtenderProvider extenderProvider, string localizedName)
{
return this.RegisterExtenderProvider(extenderProvider);
}
开发者ID:icool123,项目名称:T4Toolbox,代码行数:4,代码来源:FakeObjectExtenders.cs
注:本文中的IExtenderProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论