Наследование: Rees.Wpf.ControllerBase, IShellDialogInteractivity, IShellDialogToolTips
Пример #1
0
        // TODO Are two images on the medium sized widgets still required?

        public DashboardController(
            [NotNull] IUiContext uiContext,
            [NotNull] IDashboardService dashboardService,
            [NotNull] IApplicationDatabaseService applicationDatabaseService)
        {
            if (uiContext == null)
            {
                throw new ArgumentNullException(nameof(uiContext));
            }

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

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

            this.chooseBudgetBucketController = uiContext.ChooseBudgetBucketController;
            this.createNewFixedBudgetController = uiContext.CreateNewFixedBudgetController;
            this.createNewSurprisePaymentMonitorController = uiContext.CreateNewSurprisePaymentMonitorController;
            GlobalFilterController = uiContext.GlobalFilterController;

            this.uiContext = uiContext;
            this.dashboardService = dashboardService;

            this.chooseBudgetBucketController.Chosen += OnBudgetBucketChosenForNewBucketMonitor;
            this.createNewFixedBudgetController.Complete += OnCreateNewFixedProjectComplete;
            this.createNewSurprisePaymentMonitorController.Complete += OnCreateNewSurprisePaymentMonitorComplete;

            CorrelationId = Guid.NewGuid();

            RegisterForMessengerNotifications(uiContext.Messenger);
        }
        public DashboardController(
            [NotNull] UiContext uiContext,
            [NotNull] IWidgetRepository widgetRepository,
            [NotNull] IBudgetBucketRepository bucketRepository,
            [NotNull] ChooseBudgetBucketController chooseBudgetBucketController,
            [NotNull] WidgetService widgetService)
        {
            if (uiContext == null)
            {
                throw new ArgumentNullException("uiContext");
            }

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

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

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

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

            this.widgetRepository = widgetRepository;
            this.widgetRepository.WidgetRemoved += OnBudgetBucketMonitorWidgetRemoved;
            this.bucketRepository = bucketRepository;
            this.chooseBudgetBucketController = chooseBudgetBucketController;
            this.chooseBudgetBucketController.Chosen += OnBudgetBucketMonitorWidgetAdded;
            GlobalFilterController = uiContext.GlobalFilterController;
            CorrelationId = Guid.NewGuid();
            this.messageBox = uiContext.UserPrompts.MessageBox;

            MessengerInstance = uiContext.Messenger;
            MessengerInstance.Register<StatementReadyMessage>(this, OnStatementReadyMessageReceived);
            MessengerInstance.Register<StatementHasBeenModifiedMessage>(this, OnStatementModifiedMessagedReceived);
            MessengerInstance.Register<ApplicationStateLoadedMessage>(this, OnApplicationStateLoadedMessageReceived);
            MessengerInstance.Register<ApplicationStateRequestedMessage>(this, OnApplicationStateRequested);
            MessengerInstance.Register<BudgetReadyMessage>(this, OnBudgetReadyMessageReceived);
            MessengerInstance.Register<FilterAppliedMessage>(this, OnFilterAppliedMessageReceived);
            MessengerInstance.Register<LedgerBookReadyMessage>(this, OnLedgerBookReadyMessageReceived);


            this.updateTimer = new Timer(TimeSpan.FromMinutes(1).TotalMilliseconds)
            {
                AutoReset = true,
                Enabled = true,
            };
            this.updateTimer.Elapsed += OnUpdateTimerElapsed;

            InitialiseSupportedDependenciesArray();
            this.widgetService = widgetService;
        }