public OperationsManagerViewModel( BusyIndicatorViewModel busyIndicator, IOperationsManager operationsManager, IImportManager importManager) { _busyIndicator = busyIndicator; _operationsManager = operationsManager; _importManager = importManager; BeginExportCommand = new RelayCommand(BeginExport); BeginDataQualityAnalysisCommand = new AsyncCommand(BeginDataQualityAnalysis); CommitExportCommand = new AsyncCommand(CommitExport); CommitPendingChangesCommand = new AsyncCommand(SaveChanges); _sfd = new SaveFileDialog { OverwritePrompt = true, Filter = "csv files (*.csv)|*.csv|All Files (*.*)|*.*" }; SelectTargetFileToExportCommand = new RelayCommand(SelectTargetFileToExport); MessengerInstance.Register <AccountViewModel>(this, OnAccountViewModelReceived); _asyncMessageReceiver = new AsyncMessageReceiver(MessengerInstance); _asyncMessageReceiver.RegisterAsync <AccountImportDataChanged>(this, data => ReplayImports(data.AccountId)); DateFilter = new DateRangeFilter(); NoteFilter = new TextFilter(); _anyFilter = new CompositeFilter(DateFilter, NoteFilter); _anyFilter.FilterInvalidated += OnAnyFilterInvalidated; ResetFilterCommad = new RelayCommand(() => _anyFilter.Reset(), () => IsFiltering); }
public MainViewModel() { // Initialize Data layer var fs = new MyAccounts.Business.IO.WindowsFileSystem(); var workingCopy = new WorkingCopy(fs, Properties.Settings.Default.WorkingFolder); var accountsRepository = new AccountsRepository(workingCopy); var accountCommandRepository = new AccountCommandRepository(workingCopy); var placesRepository = new PlacesRepository(); var placeProvider = PlaceProvider.Load(placesRepository); var placeInfoResolver = new PlaceInfoResolver(placeProvider); var operationPatternTransformer = new UnifiedAccountOperationPatternTransformer(placeInfoResolver); var operationsRepository = new OperationsRepository(workingCopy, new CsvAccountOperationManager(), operationPatternTransformer); // Initialize Managers var operationsManager = new OperationsManager(App.CacheManager, operationsRepository); var accountsManager = new AccountsManager(App.CacheManager, accountsRepository); var importManager = new ImportManager(App.CacheManager, accountCommandRepository, operationsManager); // Initialize View Models BusyIndicator = new BusyIndicatorViewModel(); ImportsManagerViewModel = new ImportsManagerViewModel(BusyIndicator, fs, importManager); OperationsManagerViewModel = new OperationsManagerViewModel(BusyIndicator, operationsManager, importManager); AccountsManagerViewModel = new AccountsManagerViewModel(BusyIndicator, accountsManager, operationsManager, importManager); DashboardViewModel = new DashboardViewModel(BusyIndicator); GmcManager = new GmcManager(BusyIndicator, App.CacheManager, operationsManager); _settingsManager = new SettingsManager(App.CacheManager); MessengerInstance.Register <Properties.Settings>(this, OnSettingsUpdated); _asyncMessageReceiver = new AsyncMessageReceiver(MessengerInstance); _asyncMessageReceiver.RegisterAsync <AccountDataInvalidated>(this, data => Refresh()); if (!IsInDesignMode) { LoadCommand = new AsyncCommand(Load); RefreshCommand = new AsyncCommand(Refresh); } else { AccountsManagerViewModel.Accounts.Add( new AccountViewModel { Name = "Blaise CC", Status = { Operations = 7, Balance = 2541.7345M, LastImportedOperation = "2012-0001" } }); AccountsManagerViewModel.CurrentAccount = AccountsManagerViewModel.Accounts.First(); } }
public AccountsManagerViewModel( BusyIndicatorViewModel busyIndicatorViewModel, IAccountsManager manager, IOperationsManager operationsManager, IImportManager importsManager) { _busyIndicator = busyIndicatorViewModel; _manager = manager; _operationsManager = operationsManager; _importsManager = importsManager; LoadCommand = new AsyncCommand(LoadAsync, () => !IsEditing); BeginNewCommand = new AsyncCommand(BeginNew, () => !IsEditing); BeginEditCommand = new AsyncCommand(BeginEdit, () => !IsEditing && CurrentAccount != null); DeleteCommand = new AsyncCommand(Delete, () => !IsEditing && CurrentAccount != null); CommitEditCommand = new AsyncCommand(CommitEdit, () => IsEditing); _commands = new[] { LoadCommand, BeginEditCommand, CommitEditCommand, BeginNewCommand, DeleteCommand }; }
public GmcManager(BusyIndicatorViewModel busyIndicator, ICacheProvider cacheProvider, IOperationsManager operationsManager) { _busyIndicator = busyIndicator; _cacheProvider = cacheProvider; _operationsManager = operationsManager; Filter = new GmcManagerFilterViewModel(); Filter.FilterInvalidated += OnFilterInvalidated; LocalTransactions = new SmartCollection <BasicTransactionModel>(); RemoteTransactions = new SmartCollection <BasicTransactionModel>(); RefreshRemoteKnowledgeCommand = new AsyncCommand(ComputeDeltaWithRemote); PushChangesToGmcCommand = new AsyncCommand(PushChangesToGmc); PullCategoriesFromGmcCommand = new AsyncCommand(PullCategoriesFromGmc); ClearCurrentAccountCacheAndResetCommand = new AsyncCommand(ClearCurrentAccountCacheAndReset); MessengerInstance.Register <AccountViewModel>(this, OnAccountViewModelReceived); }
public DashboardViewModel(BusyIndicatorViewModel busyIndicator) { _busyIndicator = busyIndicator; RefreshPivotEvolutionCommand = new AsyncCommand(RefreshPivotEvolution, () => !_busyIndicator.IsBusy); Filter = new DashboardFilterViewModel(); Filter.FilterInvalidated += async(sender, arg) => { await Refresh(sender); }; _asyncMessageReceiver = new AsyncMessageReceiver(MessengerInstance); _asyncMessageReceiver.RegisterAsync <AccountsViewModelLoaded>(this, OnAccountsViewModelLoaded); PlotController = new PlotController(); // show tooltip on mouse over, instead of on click PlotController.UnbindMouseDown(OxyMouseButton.Left); PlotController.BindMouseEnter(PlotCommands.HoverSnapTrack); _selectionHandlers = new List <PlotModelRangeSelectionHandler>(); _pivotEvolutionMainMetric = nameof(CompareCellModel.Balance); _pivotEvolutionPeriod = RecurrenceFamily.Yearly; }
public ImportsManagerViewModel(BusyIndicatorViewModel busyIndicator, IFileSystem fileSystem, IImportManager importManager) { _busyIndicator = busyIndicator; _importManager = importManager; Fs = fileSystem; ReplayImportsCommand = new RelayCommand(ReplayImports); BeginImportCommand = new RelayCommand(BeginNewImport); BeginEditImportsCommand = new AsyncCommand(BeginEditImport); CommitEditCommand = new AsyncCommand(CommitEdit); CancelEditCommand = new RelayCommand(CancelEdit); SelectFilesToImportCommand = new RelayCommand(SelectFilesToImport); DeleteImportsCommand = new AsyncCommand(DeleteImports); MessengerInstance.Register <AccountViewModel>(this, OnAccountViewModelReceived); SelectedImports = new ObservableCollection <ImportCommandGridModel>(); _ofd = new OpenFileDialog { Multiselect = true, Filter = "csv files (*.csv)|*.csv|All Files (*.*)|*.*" }; }