コード例 #1
0
        public override void WriteFilterMethod(HandlerNode handlerNode, TemplateContext ctx, CodeMemberMethod handlerFilterMethod,
                                               CodeMethodInvokeExpression invoker)
        {
            var component = handlerNode.InputFrom <IMappingsConnectable>();

            invoker.Parameters.Add(new CodeSnippetExpression(string.Format("data.Component as {0}", component.Name)));
            handlerFilterMethod.Statements.Add(invoker);
        }
コード例 #2
0
        public override void WriteSetupMethod(HandlerNode handlerNode, TemplateContext ctx, CodeMemberMethod handlerMethod)
        {
            var component = handlerNode.InputFrom <IMappingsConnectable>();

            ctx._("this.OnEvent<ComponentDestroyedEvent>().Where(x=>x.Component is {0}).Subscribe(_=>{{ {1}(_); }}).DisposeWith(this)",
                  component.Name,
                  handlerNode.HandlerFilterMethodName
                  );
        }