private string GetWeakSubscribeMethodName( [NotNull] ExtensionsGenerationOptions typeExtensionsGenerationOptions, [NotNull] EventGenerationOptions typeEventGenerationOptions) { return(string.IsNullOrWhiteSpace(typeExtensionsGenerationOptions.ExtensionsMethodsGenericTypeParameters) ? $"{typeEventGenerationOptions.EventName}WeakSubscribe" : $"{typeEventGenerationOptions.EventName}WeakSubscribe<{typeExtensionsGenerationOptions.ExtensionsMethodsGenericTypeParameters}>"); }
internal WeakEventSubscriptionGenerator([NotNull] EventGenerationOptions typeEventGenerationOptions) { TypeEventGenerationOptions = typeEventGenerationOptions ?? throw new ArgumentNullException(nameof(typeEventGenerationOptions)); }
private string GetWeakEventSubscriptionClassName([NotNull] string typeClassName, [NotNull] EventGenerationOptions typeEventGenerationOptions) { if (string.IsNullOrWhiteSpace(typeClassName)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(typeClassName)); } if (typeEventGenerationOptions == null) { throw new ArgumentNullException(nameof(typeEventGenerationOptions)); } var sanitizedClassName = typeEventGenerationOptions.EventHandlerClassName.WithoutNamespace().WithoutGenericPart(); return(typeEventGenerationOptions.IsGenericEventHandler ? $"{sanitizedClassName}WeakEventSubscription<{typeClassName}, {typeEventGenerationOptions.EventArgsClassName}>" : $"{sanitizedClassName}WeakEventSubscription<{typeClassName}>"); }
private string GetPassedEventHandlerDeclarationName([NotNull] EventGenerationOptions typeEventGenerationOptions) { return(string.IsNullOrWhiteSpace(typeEventGenerationOptions.EventArgsClassName) ? nameof(EventHandler) : $"{nameof(EventHandler)}<{typeEventGenerationOptions.EventArgsClassName}>"); }