Example #1
0
        public ConfigureActionViewModel(IDeviceRepository deviceRepository,
                                        IActionTypeRepository actionTypeRepository, IActionRepository actionRepository, IActionUpdater actionUpdater)
        {
            if (deviceRepository == null)
            {
                throw new ArgumentNullException(nameof(deviceRepository));
            }
            if (actionTypeRepository == null)
            {
                throw new ArgumentNullException(nameof(actionTypeRepository));
            }
            if (actionRepository == null)
            {
                throw new ArgumentNullException(nameof(actionRepository));
            }
            if (actionUpdater == null)
            {
                throw new ArgumentNullException(nameof(actionUpdater));
            }

            _deviceRepository     = deviceRepository;
            _actionTypeRepository = actionTypeRepository;
            _actionRepository     = actionRepository;
            _actionUpdater        = actionUpdater;

            ActionTriggers  = new ObservableCollection <ActionTrigger>();
            Devices         = new ObservableCollection <Device>();
            ActionTypes     = new ObservableCollection <ActionType>();
            ActionArguments = new ObservableCollection <ActionArgument>();
            SaveCommand     = new TransactionalCommandTask(Save, CanSave);

            MessengerInstance.Register <TasksUpdated>(this, t => ActionIdentifier = null);
        }
        public ConfigureActionViewModel(IDeviceRepository deviceRepository, 
            IActionTypeRepository actionTypeRepository, IActionRepository actionRepository, IActionUpdater actionUpdater)
        {
            if (deviceRepository == null) throw new ArgumentNullException(nameof(deviceRepository));
            if (actionTypeRepository == null) throw new ArgumentNullException(nameof(actionTypeRepository));
            if (actionRepository == null) throw new ArgumentNullException(nameof(actionRepository));
            if (actionUpdater == null) throw new ArgumentNullException(nameof(actionUpdater));

            _deviceRepository = deviceRepository;
            _actionTypeRepository = actionTypeRepository;
            _actionRepository = actionRepository;
            _actionUpdater = actionUpdater;

            ActionTriggers = new ObservableCollection<ActionTrigger>();
            Devices = new ObservableCollection<Device>();
            ActionTypes = new ObservableCollection<ActionType>();
            ActionArguments = new ObservableCollection<ActionArgument>();
            SaveCommand = new TransactionalCommandTask(Save, CanSave);

            MessengerInstance.Register<TasksUpdated>(this, t => ActionIdentifier = null);
        }