func init // adds using namespace sys.add_use('System.ServiceModel') // use external class sys.UseClass("IImageService") // adds assembly sys.add_assembly('Emgu.CV', 'Emgu.CV.dll', 'assembly\\Emgu\\2.0.0\\') sys.file_copyto('' + code(packet_dir()) + 'assembly\\Emgu\\2.0.0\\zlib.net.dll', code(project_dir()) && 'zlib.net.dll') // initialize instance sys.add_var(this.name, 'Webservice_Host.IImageService') sys.add_var('binding', 'BasicHttpBinding') if(this.props('Constructor').value == 'Constructor') this.make_code(blk_init, sys.get_typed_field("", 'URI', 2)) end if(linked("Width") or linked("Height") ) sys.add_var('image', 'Image') end // initialize properties if(platform_target != 'x86') warning(this.name + ' - change property «Platform» to «x86»') end end func doConstructor(data) this.make_code(blk, d("URI")) end func doGrabFrame() if(linked("Width") or linked("Height") ) blk.println(this.image, ' = ', this.codename, '.GrabFrame();') event('onImage', this.image) else event('onImage', this.codename + '.GrabFrame()') end end func make_code(blkout, uri) blkout.println(this.binding, ' = new BasicHttpBinding();') .println(this.binding, '.MaxReceivedMessageSize = 5000000;') .println(this.codename, ' = new ChannelFactory(', this.binding, ').CreateChannel(new EndpointAddress(', uri, '));') end func Client return(this.codename) end func Width return(this.image + '.Width') end func Height return(this.image + '.Height') end