private static IMethodDeclaration CreateCSInvocator(IEventDeclaration eventDeclaration, IModifiers modifiers, IList<IArgument> arguments,
            IList<IParameter> parameters, IConstructLanguage language)
        {
            IVariableDeclaration variable = language.Variable(
                eventDeclaration.TypeName,
                language.VariableAccess(eventDeclaration.Identifier));

            NamingPolicy variablesNamingPolicy = variable.PrimaryNamingPolicy(eventDeclaration.FileModel.UserSettings);
            string variableName = variablesNamingPolicy.ChangeNameAccordingToPolicy("on" + eventDeclaration.Identifier.Name,
                eventDeclaration.SolutionModel);

            variable.Identifier = language.Identifier(variableName);

            IIfStatement ifStatement = language.IfStatement(
                language.BinaryExpression(
                    language.VariableAccess(variable.Identifier),
                    Operator.NotEqual,
                    language.New<INull>()),
                language.Block(
                    language.ExpressionStatement(
                        language.DelegateInvocation(
                            language.VariableAccess(variable.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(
                    variable,
                    ifStatement));

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

            method.Identifier = language.Identifier(methodName);

            return method;
        }
        private static IMethodDeclaration CreateCSInvocator(IEventDeclaration eventDeclaration, IModifiers modifiers, IList <IArgument> arguments,
                                                            IList <IParameter> parameters, IConstructLanguage language)
        {
            IVariableDeclaration variable = language.Variable(
                eventDeclaration.TypeName,
                language.VariableAccess(eventDeclaration.Identifier));

            NamingPolicy variablesNamingPolicy = variable.PrimaryNamingPolicy(eventDeclaration.FileModel.UserSettings);
            string       variableName          = variablesNamingPolicy.ChangeNameAccordingToPolicy("on" + eventDeclaration.Identifier.Name,
                                                                                                   eventDeclaration.SolutionModel);

            variable.Identifier = language.Identifier(variableName);

            IIfStatement ifStatement = language.IfStatement(
                language.BinaryExpression(
                    language.VariableAccess(variable.Identifier),
                    Operator.NotEqual,
                    language.New <INull>()),
                language.Block(
                    language.ExpressionStatement(
                        language.DelegateInvocation(
                            language.VariableAccess(variable.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(
                    variable,
                    ifStatement));

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

            method.Identifier = language.Identifier(methodName);

            return(method);
        }