private static IMethodDeclaration CreateVBInvocator(IEventDeclaration eventDeclaration, IModifiers modifiers,
                                                            IList <IArgument> arguments, IList <IParameter> parameters, IConstructLanguage language)
        {
            IEventInvocation eventInvocation = language.New <IEventInvocation>();

            eventInvocation.DelegateInvocation =
                language.DelegateInvocation(
                    language.VariableAccess(eventDeclaration.Identifier),
                    language.Arguments(arguments));

            IMethodDeclaration method = language.Method(
                language.None <IDocComment>(),
                language.None <IAttributes>(),
                modifiers,
                language.TypeName(eventDeclaration.VoidTypeAtThisLocation()),
                language.None <IMethodTypeParameters>(),
                language.Parameters(parameters),
                language.Block(
                    language.ExpressionStatement(eventInvocation)));

            NamingPolicy methodsNamingPolicy = method.PrimaryNamingPolicy(eventDeclaration.FileModel.UserSettings);
            string       methodName          = methodsNamingPolicy.ChangeNameAccordingToPolicy("Raise" + eventDeclaration.Identifier.Name + "Event",
                                                                                               eventDeclaration.SolutionModel);

            method.Identifier = language.Identifier(methodName);

            return(method);
        }
Exemple #2
0
 private void ExecuteEvents()
 {
     while (executingEvents.Count > 0)
     {
         IEventInvocation invocation = executingEvents.Dequeue();
         invocation.Execute();
         invocation.Recycle();
     }
 }
Exemple #3
0
 internal void Queue(IEventInvocation eventInvocation)
 {
     try
     {
         spinLock.Lock();
         waitingEvents.Enqueue(eventInvocation);
     }
     finally
     {
         spinLock.Unlock();
     }
 }