Пример #1
0
        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);
        }
Пример #2
0
        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);
        }