Esempio n. 1
0
        public MainWindow()
        {
            InitializeComponent();

            IList<IDataBaseExtender> dbExtenders = new List<IDataBaseExtender>();
            dbExtenders.Add(new LocalCameraDevice());
            _config = new HomeSecureConfig("HomeSecureData", dbExtenders);

            _controller = new ClientController(this, _config);
            _controller.ApplicationStarted();

            _eventLogForm = new EventLog();

            _config.GetSecurityEvents().ForEach(a => _eventLogForm.AddSecurityEvent(a));

            EventLogNotification eventLogNotification = new EventLogNotification(_eventLogForm);
            TimeoutFilter filter = new TimeoutFilter(eventLogNotification);
            _controller.AddSecurityEventSubscriber(filter);
        }
        private void InitNotifications()
        {
            _notifications = new List<SecurityEventSubscriber>();
            List<NotificationEntityData> notificationsData = _config.GetNotificationsData();
            foreach (NotificationEntityData notificationData in notificationsData)
            {
                SecurityEventSubscriber notification = Activator.CreateInstance(Type.GetType(notificationData.Type)) as SecurityEventSubscriber;
                notification.InitParams(notificationData.NotificationParams.ToDictionary(a => a.Key));

                TimeoutFilter timeoutFilter = new TimeoutFilter(notification);
                AddSecurityEventSubscriber(timeoutFilter);
            }

            SaveToDatabaseSecurityEventSubscriber saveToDbSubscriber = new SaveToDatabaseSecurityEventSubscriber(_config);
            TimeoutFilter saveToDbTimeoutFilter = new TimeoutFilter(saveToDbSubscriber);
            AddSecurityEventSubscriber(saveToDbTimeoutFilter);

            ServiceSecurityEventSubscriber serviceSubscriber = new ServiceSecurityEventSubscriber();
            TimeoutFilter serviceTimeoutFilter = new TimeoutFilter(serviceSubscriber);
            AddSecurityEventSubscriber(serviceTimeoutFilter);
        }