Beispiel #1
0
        public LedgerBookController(
            [NotNull] UiContext uiContext,
            [NotNull] LedgerBookControllerFileOperations fileOperations,
            [NotNull] LedgerBookGridBuilderFactory uiBuilder,
            [NotNull] ILedgerService ledgerService,
            [NotNull] IReconciliationService reconService,
            [NotNull] NewWindowViewLoader newWindowViewLoader)
        {
            if (uiContext == null)
            {
                throw new ArgumentNullException(nameof(uiContext));
            }

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

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

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

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

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

            this.uiBuilder                    = uiBuilder;
            this.ledgerService                = ledgerService;
            this.reconService                 = reconService;
            this.newWindowViewLoader          = newWindowViewLoader;
            this.messageBox                   = uiContext.UserPrompts.MessageBox;
            this.questionBox                  = uiContext.UserPrompts.YesNoBox;
            this.inputBox                     = uiContext.UserPrompts.InputBox;
            FileOperations                    = fileOperations;
            FileOperations.LedgerService      = this.ledgerService;
            this.uiContext                    = uiContext;
            this.doNotUseNumberOfMonthsToShow = 2;

            MessengerInstance = uiContext.Messenger;
            MessengerInstance.Register <BudgetReadyMessage>(this, OnBudgetReadyMessageReceived);
            MessengerInstance.Register <StatementReadyMessage>(this, OnStatementReadyMessageReceived);

            this.ledgerService.Saved  += OnSaveNotificationReceieved;
            this.ledgerService.Closed += OnClosedNotificationReceived;
            this.ledgerService.NewDataSourceAvailable += OnNewDataSourceAvailableNotificationReceived;
        }
        public BudgetController(
            [NotNull] IBudgetRepository budgetRepository,
            [NotNull] UiContext uiContext,
            [NotNull] DemoFileHelper demoFileHelper,
            [NotNull] IBudgetBucketRepository bucketRepo)
        {
            if (budgetRepository == null)
            {
                throw new ArgumentNullException("budgetRepository");
            }

            if (uiContext == null)
            {
                throw new ArgumentNullException("uiContext");
            }

            if (demoFileHelper == null)
            {
                throw new ArgumentNullException("demoFileHelper");
            }

            if (bucketRepo == null)
            {
                throw new ArgumentNullException("bucketRepo");
            }

            this.demoFileHelper = demoFileHelper;
            this.bucketRepo = bucketRepo;
            this.budgetRepository = budgetRepository;
            this.questionBox = uiContext.UserPrompts.YesNoBox;
            this.messageBox = uiContext.UserPrompts.MessageBox;
            this.fileOpenDialogFactory = uiContext.UserPrompts.OpenFileFactory;
            this.fileSaveDialogFactory = uiContext.UserPrompts.SaveFileFactory;
            this.inputBox = uiContext.UserPrompts.InputBox;
            BudgetPieController = uiContext.BudgetPieController;
            Shown = false;

            MessengerInstance = uiContext.Messenger;
            MessengerInstance.Register<ApplicationStateRequestedMessage>(this, OnApplicationStateRequested);
            MessengerInstance.Register<ApplicationStateLoadedMessage>(this, OnApplicationStateLoaded);
            MessengerInstance.Register<ShellDialogResponseMessage>(this, OnPopUpResponseReceived);

            var budget = new BudgetModel();
            CurrentBudget = new BudgetCurrencyContext(new BudgetCollection(new[] { budget }), budget);
        }
        public BudgetController(
            [NotNull] UiContext uiContext,
            [NotNull] IBudgetMaintenanceService maintenanceService,
            [NotNull] IApplicationDatabaseService applicationDatabaseService)
        {
            if (uiContext == null)
            {
                throw new ArgumentNullException(nameof(uiContext));
            }

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

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

            this.maintenanceService = maintenanceService;
            this.applicationDatabaseService = applicationDatabaseService;
            this.questionBox = uiContext.UserPrompts.YesNoBox;
            this.messageBox = uiContext.UserPrompts.MessageBox;
            this.inputBox = uiContext.UserPrompts.InputBox;
            BudgetPieController = uiContext.BudgetPieController;
            NewBudgetController = uiContext.NewBudgetModelController;
            NewBudgetController.Ready += OnAddNewBudgetReady;
            Shown = false;

            MessengerInstance = uiContext.Messenger;
            MessengerInstance.Register<ShellDialogResponseMessage>(this, OnPopUpResponseReceived);
            this.maintenanceService.Closed += OnClosedNotificationReceived;
            this.maintenanceService.NewDataSourceAvailable += OnNewDataSourceAvailableNotificationReceived;
            this.maintenanceService.Saving += OnSavingNotificationReceived;
            this.maintenanceService.Validating += OnValidatingNotificationReceived;
            this.maintenanceService.Saved += OnSavedNotificationReceived;

            CurrentBudget = new BudgetCurrencyContext(this.maintenanceService.Budgets, this.maintenanceService.Budgets.CurrentActiveBudget);
        }
        public BudgetController(
            [NotNull] UiContext uiContext,
            [NotNull] IBudgetMaintenanceService maintenanceService,
            [NotNull] IApplicationDatabaseService applicationDatabaseService)
        {
            if (uiContext == null)
            {
                throw new ArgumentNullException(nameof(uiContext));
            }

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

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

            this.maintenanceService         = maintenanceService;
            this.applicationDatabaseService = applicationDatabaseService;
            this.questionBox           = uiContext.UserPrompts.YesNoBox;
            this.messageBox            = uiContext.UserPrompts.MessageBox;
            this.inputBox              = uiContext.UserPrompts.InputBox;
            BudgetPieController        = uiContext.BudgetPieController;
            NewBudgetController        = uiContext.NewBudgetModelController;
            NewBudgetController.Ready += OnAddNewBudgetReady;
            Shown = false;

            MessengerInstance = uiContext.Messenger;
            MessengerInstance.Register <ShellDialogResponseMessage>(this, OnPopUpResponseReceived);
            this.maintenanceService.Closed += OnClosedNotificationReceived;
            this.maintenanceService.NewDataSourceAvailable += OnNewDataSourceAvailableNotificationReceived;
            this.maintenanceService.Saving     += OnSavingNotificationReceived;
            this.maintenanceService.Validating += OnValidatingNotificationReceived;
            this.maintenanceService.Saved      += OnSavedNotificationReceived;

            CurrentBudget = new BudgetCurrencyContext(this.maintenanceService.Budgets, this.maintenanceService.Budgets.CurrentActiveBudget);
        }
        public UserPrompts(
            [NotNull] IUserMessageBox messageBox,
            [NotNull] Func <IUserPromptOpenFile> openFileFactory,
            [NotNull] Func <IUserPromptSaveFile> saveFileFactory,
            [NotNull] IUserQuestionBoxYesNo yesNoBox,
            [NotNull] IUserInputBox inputBox)
        {
            if (messageBox == null)
            {
                throw new ArgumentNullException(nameof(messageBox));
            }

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

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

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

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

            OpenFileFactory = openFileFactory;
            SaveFileFactory = saveFileFactory;
            MessageBox      = messageBox;
            YesNoBox        = yesNoBox;
            InputBox        = inputBox;
        }