/// <summary> /// Called at runtime, creates the implementation of the <see cref="INotifyCollectionChange"/> interface. /// /// NOTE: tries to get implementation of aspect from instance, othrewise create a new one /// this is critical for objects with multiple constructors (see generated code in Reflector) /// </summary> /// <param name="eventArgs">Execution context.</param> /// <returns>A new instance of <see cref="NotifyCollectionChangeImplementation"/>, which implements /// <see cref="INotifyCollectionChange"/>.</returns> public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs) { InstanceCredentials credentials = eventArgs.InstanceCredentials; if (logging) { /* * log.DebugFormat("Creating new instance of interceptor for object {0}, credentials: {1}", * eventArgs.Instance, * InstanceCredentialsConvertor.ToString(eventArgs.InstanceCredentials)); */ } object implementation = ((IComposed <INotifyCollectionChange>)eventArgs.Instance).GetImplementation( eventArgs.InstanceCredentials); if (implementation != null) { if (logging) { /* * log.DebugFormat( * "Instance already has an implementation injected - returning it and updating credentials {0} > ({1})", * ((NotifyCollectionChangeImplementation) implementation).InstanceCredentials, * InstanceCredentialsConvertor.ToString(credentials)); */ } ((NotifyCollectionChangeImplementation)implementation).InstanceCredentials = credentials.ToString(); } return(implementation ?? new NotifyCollectionChangeImplementation(eventArgs.Instance, eventArgs.InstanceCredentials, logging)); }
private void LoadCredentials() { InstanceCredentials = WindowsCredentialsStore.Default.GetCredentialsForInstance(_instance); if (InstanceCredentials.Count() == 0) { InstanceCredentials = s_addNewCredentials; HasCredentials = false; } else { HasCredentials = true; } ActionCommand.CanExecuteCommand = HasCredentials; CurrentCredentials = InstanceCredentials.FirstOrDefault(); }
/// <summary> /// Initializes a new <see cref="NotifyPropertyChangedImplementation"/> instance. /// </summary> /// <param name="instance">Instance of the object where aspect is applied.</param> public NotifyPropertyChangedImplementation(object instance, InstanceCredentials credentials, bool logging) { this.instance = instance; this.logging = logging; var type = instance.GetType(); if (!cachedIsLastPropertyNotifier.ContainsKey(type)) { var composedBaseTypes = type.GetInterfaces() .Where(t => t.Name.Contains("IComposed") && t.IsGenericType); var thisType = typeof (IComposed<INotifyPropertyChanged>); isLastPropertyNotifier = thisType == composedBaseTypes.Last(); cachedIsLastPropertyNotifier[type] = isLastPropertyNotifier; } else { isLastPropertyNotifier = cachedIsLastPropertyNotifier[type]; } }
/// <summary> /// Initializes a new <see cref="NotifyPropertyChangedImplementation"/> instance. /// </summary> /// <param name="instance">Instance of the object where aspect is applied.</param> public NotifyPropertyChangedImplementation(object instance, InstanceCredentials credentials, bool logging) { this.instance = instance; this.logging = logging; var type = instance.GetType(); if (!cachedIsLastPropertyNotifier.ContainsKey(type)) { var composedBaseTypes = type.GetInterfaces() .Where(t => t.Name.Contains("IComposed") && t.IsGenericType); var thisType = typeof(IComposed <INotifyPropertyChanged>); isLastPropertyNotifier = thisType == composedBaseTypes.Last(); cachedIsLastPropertyNotifier[type] = isLastPropertyNotifier; } else { isLastPropertyNotifier = cachedIsLastPropertyNotifier[type]; } }
// TODO: make it join several calls into 1 //private static DateTime lastCallTime; /// <summary> /// Initializes a new <see cref="NotifyCollectionChangedImplementation"/> instance. /// </summary> /// <param name="instance">Instance of the object where aspect is applied.</param> public NotifyCollectionChangedImplementation(object instance, InstanceCredentials credentials, bool logging) { this.instance = instance; this.intanceCredentials = credentials.ToString(); this.logging = logging; }
public EditableObjectImplementation(IProtectedInterface <IEditableObject> parentObject, InstanceCredentials credentials) { this.credentials = credentials; this.parentObject = parentObject; }