Example #1
0
	    public GraphController(Graph viewModel, 
            IDownloadStringService downloadStringService,
            ITimer timer,
            Configuration configuration,
            IProgressbar progressbarService)
		{
	        Guard.Requires<ArgumentNullException>(viewModel != null);
            Guard.Requires<ArgumentNullException>(downloadStringService != null);
            Guard.Requires<ArgumentNullException>(timer != null);
            Guard.Requires<ArgumentNullException>(progressbarService != null);
            Guard.Requires<ArgumentNullException>(configuration != null);

            graphConfig = new GraphConfig(configuration);

            Guard.Requires<ArgumentException>(graphConfig.IsValid, graphConfig.ErrorMsg);

			this.ViewModel = viewModel;
            ViewModel.Refresh.AfterExecute += new EventHandler(Refresh_AfterExecute);
            this.downloadStringService = downloadStringService;
            this.timer = timer;
            this.timer.Elapsed += new EventHandler(timer_Elapsed);
            this.progressbarService = progressbarService;

	        StartFetchingDataInBackground();

	        DownloadDataAndAddToViewModel();
		}
	    public GraphSettingsController(GraphSettings graphSettingsViewModel,
            GraphController graphController,
            Configuration configuration,
            IDownloadStringService downloadStringService,
            IPersistDomainModels<Configuration> configRepository)
		{
	        Guard.Requires<ArgumentNullException>(graphSettingsViewModel != null);
            Guard.Requires<ArgumentNullException>(graphController != null);
            Guard.Requires<ArgumentNullException>(configuration != null);
            Guard.Requires<ArgumentNullException>(downloadStringService != null);
            Guard.Requires<ArgumentNullException>(configRepository != null);

            this.graphController = graphController;
            GraphSettingsViewModel = graphSettingsViewModel;
	        GraphSettingsViewModel.Graph = GraphViewModel;
            GraphSettingsViewModel.PropertyChanged += ViewModel_PropertyChanged;
            GraphSettingsViewModel.Save.AfterExecute += ViewModel_Save_AfterExecute;
            GraphSettingsViewModel.Test.AfterExecute += ViewModel_Test_AfterExecute;
            graphSettingsViewModel.Cancel.AfterExecute += ViewModel_Cancel_AfterExecute;
            this.downloadStringService = downloadStringService;
            this.configRepository = configRepository;
            graphConfig = new GraphConfig(configuration);
            backupConfig = new GraphConfig(configuration.Clone() as Configuration);

		    DownloadAndLoadDataIntoViewModel();
		}
Example #3
0
            public void Setup()
            {
                graphConfig =new GraphConfig(GraphConfig.NewDefaultConfiguration());
                graphConfig.Database = "Webshop";
                graphConfig.Collection = "ordersPrDay";
                graphConfig.MaxNumberOfDataPoints = 3;
                graphConfig.XAxisProperty = "Date";
                graphConfig.YAxisProperty = "NumberOfSales";
                graphConfig.IsConfigured = true;

                downloadStringServiceFake = new Mock<IDownloadStringService>();
                graph = new Graph();
                timerFake = new Mock<ITimer>();
                progressBarServiceFake = new Mock<IProgressbar>();

                Before();
            }
Example #4
0
	    public void UpdateConfiguration(Configuration config)
	    {
	        graphConfig = new GraphConfig(config);

            DownloadDataAndAddToViewModel();
	    }
	    public void UpdateConfiguration(Configuration config)
	    {
            graphConfig = new GraphConfig(config);
            backupConfig = new GraphConfig(config.Clone() as Configuration);

            DownloadAndLoadDataIntoViewModel();
	    }