示例#1
0
        public ReaViewModel()
        {
            _movements = new List<Movement>();

            consumerConfig = new ConsumerConfig();

            for (int i = 1; i < Properties.Settings.Default.AcqMovementsList.Count; i++)
                _movements.Add(new Movement(i, Properties.Settings.Default.AcqMovementsList[i]));

            reaModel = new ReaModel();
            reaModel.PropertyChanged += reaModel_PropertyChanged;
            InstanceManager<PatternRecognizer>.Instance.ContentChanged += InstanceManagerPatternRecognizer_ContentChanged;

            _movDisplayConsumer = GenericFactory<RealtimeConsumer>.Instance.CreateProduct(Properties.Settings.Default.ReaMovDisplayer);
            if (_movDisplayConsumer != null) _movDisplayConsumer.objectServer = reaModel.objectServer;

            _consumerList = new List<RealtimeConsumer>();

            //Populate the consumer list with realtimeConsumer instances from those subclasses enabled
            //through program configuration.
            foreach (string item in Properties.Settings.Default.ReaConsumerList)
            {

                RealtimeConsumer realtimeConsumer = GenericFactory<RealtimeConsumer>.Instance.CreateProduct(item);
                if (realtimeConsumer != null)
                {
                    _consumerList.Add(realtimeConsumer);
                    realtimeConsumer.objectServer = reaModel.objectServer;
                    realtimeConsumer.consumerConfig = consumerConfig;
                }
            }

            this.PropertyChanged += ReaViewModel_PropertyChanged;
        }
示例#2
0
        /// <summary>
        /// Unhooks the list of available movements in the ConsumerConfig object from the handler defined for it in this class.
        /// </summary>
        /// <param name="consumerConfig"></param>
        protected override void ConsumerConfigUnhook(ConsumerConfig consumerConfig)
        {
            base.ConsumerConfigUnhook(consumerConfig);

            consumerConfig.availableMovements.CollectionChanged -= availableMovements_CollectionChanged;
        }
示例#3
0
 /// <summary>
 /// Used when the ConsumerConfig instance changes value. When overriden, this method allows descendant classes
 /// to unregister event handlers that may be attached to attributes od the ConsumerConfig instance
 /// (for instance, an ObservableCollection).
 /// </summary>
 /// <param name="consumerConfig"></param>
 protected virtual void ConsumerConfigUnhook(ConsumerConfig consumerConfig)
 {
 }