private static void TimerStorage_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { TimerStorageBase timerStorageBase = sender as TimerStorageBase; TimerManagerConfig.sendTimerData(timerStorageBase, false); if (e.PropertyName == nameof(timerStorageBase.TimerStatus) && timerStorageBase.TimerStatus == TimerStatus.Stopped) { timerStorageBase.Dispose(); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); TimerManagerConfig.initializeTimerManager(); HearConfig.initializeHear(); //Mapper.Initialize(t => ConverterConfig.configConverters(t)); var config = new MapperConfiguration(cfg => ConverterConfig.configConverters(cfg)); var mapper = config.CreateMapper(); ConverterConfig.Mapper = mapper; }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); TimerManagerConfig.initializeTimerManager(); ProducerAndConsumerMediatorConfig.initializeProducerAndConsumerMediator(); //Mapper.Initialize(t => ConverterConfig.configConverters(t)); var config = new MapperConfiguration(cfg => ConverterConfig.configConverters(cfg)); var mapper = config.CreateMapper(); ConverterConfig.Mapper = mapper; AutofacConfig.configAutofac(); }
private static void TimerManagerConfig_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.NewItems != null) { e.NewItems.Cast <TimerStorageBase>().ToList() .ForEach(timerStorage => { TimerManagerConfig.sendTimerData(timerStorage, false); timerStorage.PropertyChanged += TimerManagerConfig.TimerStorage_PropertyChanged; }); } if (e.OldItems != null) { e.OldItems.Cast <TimerStorageBase>().ToList() .ForEach(timerStorage => { TimerManagerConfig.sendTimerData(timerStorage, true); timerStorage.PropertyChanged -= TimerManagerConfig.TimerStorage_PropertyChanged; }); } }