Esempio n. 1
0
        public StatementsViewModel(IContext context, IParser[] supportedParsers, 
            IResolveClassificationConflicts resolveConflicts, IMessageBoxService messageBoxService)
        {
            _context = context;
            _operationRepository = context.GetRepository<IRepository<BankOperation>>();
            _statementsRepository = context.GetRepository<IRepository<BankStatement>>();

            _supportedParsers = supportedParsers.OrderBy(a => a.Name);
            _importer = new OperationsImporter(_operationRepository, _statementsRepository);
            _messageBoxService = messageBoxService;
            _resolveConflicts = resolveConflicts;

            ApplyRules = true;
            ChosenParser = SupportedParsers.FirstOrDefault();
            ResetListData();

            LoadFileCommand = new DelegateCommand(LoadFromFile);
            LoadRawTextCommand = new DelegateCommand(DoLoadFromRawText, CanLoadFromRawText);
            DeleteStatementCommand = new DelegateCommand(DeleteSelected, CanDelete);
        }
Esempio n. 2
0
        public OperationsViewModel(IContext context, IRegionManager regionManager, 
            IResolveClassificationConflicts resolveConflicts, IMessageBoxService messageBoxService)
        {
            _context = context;
            _operationRepository = context.GetRepository<IRepository<BankOperation>>();

            _resolveConflicts = resolveConflicts;
            _regionManager = regionManager;
            _messageBoxService = messageBoxService;

            InitializeFilteringProperties();
            InitializeGrouppingProperties();

            defferedDataUpdate = new DeferredAction(
                Dispatcher.CurrentDispatcher,
                () => { if (Data != null) Data.Refresh(); },
                500);

            ApplyRules = new DelegateCommand(() => DoApplyRules());
            ClearRules = new DelegateCommand(() => DoClearRules());
            Save = new DelegateCommand(DoSave);
            SelectNext = new DelegateCommand<bool?>(DoSelectNext);
            CreateRule = new DelegateCommand(DoCreateRule, () => SelectedOperation != null);
        }