Example #1
0
        static void Main(string[] args)
        {
            NotificationFinder notificationFinder = new NotificationFinder();
            var notificationTypes = notificationFinder.FindAvailableEvents(DateTime.Now).GroupBy(e => e.NotificationTypeId);

            INotificationHandler notificationHandler;

            foreach (var group in notificationTypes)
            {
                List <Events> events = new List <Events>();
                Console.WriteLine(group.Key);
                foreach (var g in group)
                {
                    events.Add(g);
                }

                notificationHandler = NotificationHandlerFactory.GetHandler(group.Key);
                notificationHandler.create(events);
            }
            Console.ReadLine();
        }
Example #2
0
 private void InitConfigurator()
 {
     try
     {
         //WindsorConfigurator.Configurator = new HandlerWindsorConfigurator();
         //WindsorRegistrar.Register(typeof(IConnectedInfoProvider), typeof(ConnectedInfoProvider));
         //WindsorConfigurator.Configurator.Configure();
         //IoC.Build();
         var handler = new NotificationHandler();
         NotificationHandlerFactory.SetNotificationHandler(handler);
         NotificationClientContextManager.NotificationClientContextFactory =
             new NotificationClientContextFactory();
         handler.UserOnLined          += new EventHandler <EventArgs <User> >(NotificationController.Notification_UserOnLined);
         handler.RoleAuthorityChanged += new EventHandler(NotificationController.OnRoleAuthorityChanged_Handle);
     }
     catch (Exception ex)
     {
         ex = new Exception("注入服务以及服务相关对象失败!", ex);
         Log.Error(ex);
     }
 }