public WorkingDaysLeftController(
            WorkingDaysLeftViewModel leftViewModel,
            WorkingDaysLeftSettingsViewModel settingsViewModel,
            IAsyncRepository<ProjectInfoServer> projectInforepository,
            IAsyncRepository<Holiday> holidayRepository,
            ITimer refreshNotifier,
            ILog logger,
            IProgressbar loadingNotifier,
            Configuration config)
        {
            this.leftViewModel = leftViewModel;
            this.settingsViewModel = settingsViewModel;
            this.holidayRepository = holidayRepository;
            this.projectInforepository = projectInforepository;
            this.logger = logger;
            this.loadingNotifier = loadingNotifier;
            this.refreshNotifier = refreshNotifier;

            this.Rand = new Random((int)DateTime.Now.Ticks).Next();

            projectInforepository.GetCompleted += GotProjectInfo;
            holidayRepository.GetCompleted += GotHolidays;

            this.settingsViewModel.RefreshAvailableServers.ExecuteDelegate = OnRefreshAvailableServers;
            this.settingsViewModel.ReloadSettings.ExecuteDelegate = settingsViewModel.Reset;

            refreshNotifier.Elapsed += refreshNotifier_Elapsed;
            settingsViewModel.PropertyChanged += RefreshAvailableProjectsWhenSelectedServerChanges;
            refreshNotifier.Start(10000);

            OnRefreshAvailableServers();
            SetConfigAndUpdate(config);
        }
        public WorkingDaysLeftWidget()
        {
            Title = "Working days left";

			var viewModel = GetInstance<WorkingDaysLeftViewModel>();
			settingsViewModel = GetInstance<WorkingDaysLeftSettingsViewModel>();
        	controller = NewController<WorkingDaysLeftController>();

			View = new WorkingDaysLeft { DataContext = viewModel };
			SettingsView = new WorkingDaysLeftSettingsView { DataContext = settingsViewModel };

            PropertyChanged += WorkingDaysLeftSlide_PropertyChanged;
            ConfigurationChanged += (o, e) => controller.SetConfigAndUpdate(Configuration);

            settingsViewModel.Save.ExecuteDelegate = () => SaveSettings.Execute();
            SaveSettings.BeforeExecute += (o,e) => controller.BeforeSave();
        }
        protected static void CreateController()
        {
			RemoveAllGlobalDependencies.ForAllViewModels();
			ConfigureGlobalDependencies.ForAllViewModels(config =>
				config.Bind<IUIInvoker>().To<UIInvokerForTesting>());

            _workingDaysLeftViewModel = new WorkingDaysLeftViewModel();
            _workingDaysLeftSettingsViewModel = new WorkingDaysLeftSettingsViewModel();
            _controller = new WorkingDaysLeftRxController(
                _workingDaysLeftViewModel,
                _workingDaysLeftSettingsViewModel,
                projectRepositoryMock.Object,
                configRepositoryMock.Object,
                holidayRepositoryMock.Object,
                configPersisterRepositoryMock.Object,
                _iTimerMock.Object,
                loggerMock.Object
                );
        }
        public WorkingDaysLeftRxController(
            WorkingDaysLeftViewModel viewModel, 
            WorkingDaysLeftSettingsViewModel settingsViewModel,
            IAsyncRepository<ProjectInfoServer> projectInforepository,
            IAsyncRepository<Configuration> configRepository,
            IAsyncRepository<Holiday> holidayRepository, 
            IPersistDomainModels<Configuration> configPersisterRepository,
            ITimer refreshNotifier,
            ILog logger)
        {
            _viewModel = viewModel;
            _settingsViewModel = settingsViewModel;
            this._holidayRepository = holidayRepository;
            this._projectInforepository = projectInforepository;
            this._logger = logger;
            this._configRepository = configRepository;
            this._configPersisterRepository = configPersisterRepository;

            SetupReactiveEvents();
        }
Beispiel #5
0
 public void SetUp()
 {
     config = new Configuration{ IsConfigured = true };
     loadingNotifierMock = new Mock<IProgressbar>();
     viewModel = new WorkingDaysLeftViewModel();
     settingViewModel = new WorkingDaysLeftSettingsViewModel();
     projectRepositoryMock = new Mock<IAsyncRepository<ProjectInfoServer>>();
 }