Inheritance: ServiceConsumer
Esempio n. 1
0
        public JanusProtocolDispatcher(IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;

            _pageBuilder    = new HtmlPageBuilder(serviceProvider);
            _xmlPageBuilder = new XmlPageBuilder(serviceProvider, _pageBuilder);

            var methods = GetType().GetMethods(
                BindingFlags.DeclaredOnly
                | BindingFlags.Instance
                | BindingFlags.Public
                | BindingFlags.NonPublic
                | BindingFlags.Static);

            foreach (var mi in methods)
            {
                var attribute =
                    Attribute.GetCustomAttribute(mi, typeof(JanusProtocolEventHandlerAttribute))
                    as JanusProtocolEventHandlerAttribute;

                if (attribute != null)
                {
                    _handlers.Add(attribute.Id,
                                  (JanusProtocolEventHandler)Delegate.CreateDelegate(typeof(JanusProtocolEventHandler), this, mi.Name));
                }
            }
        }
Esempio n. 2
0
		public JanusProtocolDispatcher(IServiceProvider serviceProvider)
		{
			_serviceProvider = serviceProvider;

			_pageBuilder    = new HtmlPageBuilder(serviceProvider);
			_xmlPageBuilder = new XmlPageBuilder(serviceProvider, _pageBuilder);

			var methods = GetType().GetMethods(
				BindingFlags.DeclaredOnly
				| BindingFlags.Instance
				| BindingFlags.Public
				| BindingFlags.NonPublic
				| BindingFlags.Static);

			foreach (var mi in methods)
			{
				var attribute =
					Attribute.GetCustomAttribute(mi, typeof(JanusProtocolEventHandlerAttribute))
						as JanusProtocolEventHandlerAttribute;
				
				if (attribute != null)
					_handlers.Add(attribute.Id,
						(JanusProtocolEventHandler)Delegate.CreateDelegate(typeof(JanusProtocolEventHandler), this, mi.Name));
			}
		}