Beispiel #1
0
        public void WriteFacetAsEvent(InterfaceFacet interfaceFacet, EventFacet eventFacet, Dictionary <string, object> options = null)
        {
            // test if binding generation required
            if (!Config.GenerateFacetBinding(eventFacet))
            {
                WriteSkippedItem("event", eventFacet.Description());
                return;
            }

            // create Obj-C event ouput object
            ObjCEvent event_ = new ObjCEvent(this, interfaceFacet, eventFacet, options);

            if (!event_.IsValid)
            {
                return;
            }

            // parse options
            bool isPreDelarations = false;

            if (options != null)
            {
                object outObj;
                if (options.TryGetValue("caller", out outObj))
                {
                    isPreDelarations = (string)outObj == nameof(WriteFacetPreDeclarations);
                }
            }

            // write unique interface output for start of class
            if (OutputFileType == OutputType.Interface && isPreDelarations)
            {
                WriteEventClassStart(event_, options);
                return;
            }

            // write event name accessor method
            WriteEventNameAccessor(event_, options);

            // write event handler add method
            WriteEventHandlerAddMethod(event_, options);
        }