コード例 #1
0
        private CodeMemberMethod CreateOnRowEventMethod(string eventName, string typedEventName)
        {
            CodeMemberMethod method = CodeGenHelper.MethodDecl(CodeGenHelper.GlobalType(typeof(void)), "OnRow" + eventName, MemberAttributes.Family | MemberAttributes.Override);

            method.Parameters.Add(CodeGenHelper.ParameterDecl(CodeGenHelper.GlobalType(typeof(DataRowChangeEventArgs)), "e"));
            method.Statements.Add(CodeGenHelper.MethodCall(CodeGenHelper.Base(), "OnRow" + eventName, CodeGenHelper.Argument("e")));
            method.Statements.Add(CodeGenHelper.If(CodeGenHelper.IdNotEQ(CodeGenHelper.Event(typedEventName), CodeGenHelper.Primitive(null)), CodeGenHelper.Stm(CodeGenHelper.DelegateCall(CodeGenHelper.Event(typedEventName), CodeGenHelper.New(CodeGenHelper.Type(this.designTable.GeneratorRowEvArgName), new CodeExpression[] { CodeGenHelper.Cast(CodeGenHelper.Type(this.rowClassName), CodeGenHelper.Property(CodeGenHelper.Argument("e"), "Row")), CodeGenHelper.Property(CodeGenHelper.Argument("e"), "Action") })))));
            return(method);
        }