public RulesController(
            [NotNull] UiContext uiContext,
            [NotNull] IMatchingRuleRepository ruleRepository)
        {
            if (uiContext == null)
            {
                throw new ArgumentNullException("uiContext");
            }

            this.logger = uiContext.Logger;
            this.questionBox = uiContext.UserPrompts.YesNoBox;
            this.ruleRepository = ruleRepository;
            NewRuleController = uiContext.NewRuleController;
            RulesGroupedByBucket = new ObservableCollection<RulesGroupedByBucket>();

            MessengerInstance = uiContext.Messenger;
            uiContext.Messenger.Register<ApplicationStateRequestedMessage>(this, OnApplicationStateRequested);
            uiContext.Messenger.Register<ApplicationStateLoadedMessage>(this, OnApplicationStateLoaded);
        }
示例#2
0
        public TransactionRuleService(
            [NotNull] IMatchingRuleRepository ruleRepository,
            [NotNull] ILogger logger,
            [NotNull] IMatchmaker matchmaker,
            [NotNull] IMatchingRuleFactory ruleFactory,
            [NotNull] IEnvironmentFolders environmentFolders,
            [NotNull] MonitorableDependencies monitorableDependencies,
            [NotNull] IBudgetBucketRepository bucketRepo)
        {
            this.bucketRepo              = bucketRepo ?? throw new ArgumentNullException(nameof(bucketRepo));
            this.ruleRepository          = ruleRepository ?? throw new ArgumentNullException(nameof(ruleRepository));
            this.logger                  = logger ?? throw new ArgumentNullException(nameof(logger));
            this.matchmaker              = matchmaker ?? throw new ArgumentNullException(nameof(matchmaker));
            this.ruleFactory             = ruleFactory ?? throw new ArgumentNullException(nameof(ruleFactory));
            this.environmentFolders      = environmentFolders ?? throw new ArgumentNullException(nameof(environmentFolders));
            this.monitorableDependencies = monitorableDependencies ?? throw new ArgumentNullException(nameof(monitorableDependencies));

            this.matchingRules = new List <MatchingRule>();
            this.matchingRulesGroupedByBucket = new List <RulesGroupedByBucket>();
        }
        public TransactionRuleService(
            [NotNull] IMatchingRuleRepository ruleRepository,
            [NotNull] ILogger logger,
            [NotNull] IMatchmaker matchmaker,
            [NotNull] IMatchingRuleFactory ruleFactory,
            [NotNull] IEnvironmentFolders environmentFolders,
            [NotNull] MonitorableDependencies monitorableDependencies)
        {
            if (ruleRepository == null)
            {
                throw new ArgumentNullException(nameof(ruleRepository));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (matchmaker == null)
            {
                throw new ArgumentNullException(nameof(matchmaker));
            }

            if (ruleFactory == null)
            {
                throw new ArgumentNullException(nameof(ruleFactory));
            }

            if (environmentFolders == null) throw new ArgumentNullException(nameof(environmentFolders));
            if (monitorableDependencies == null) throw new ArgumentNullException(nameof(monitorableDependencies));

            this.ruleRepository = ruleRepository;
            this.logger = logger;
            this.matchmaker = matchmaker;
            this.ruleFactory = ruleFactory;
            this.environmentFolders = environmentFolders;
            this.monitorableDependencies = monitorableDependencies;
            this.matchingRules = new List<MatchingRule>();
            this.matchingRulesGroupedByBucket = new List<RulesGroupedByBucket>();
        }