예제 #1
0
        public GraphWidget()
        {
            Title = "Graf";

            controller = NewController<GraphController>();
            settingsController = NewController<GraphSettingsController>();

            PropertyChanged += (o, e) =>
            {
                if (IsInSettingsMode)
                    controller.StopFetchingDataInBackground();
                else
                    controller.StartFetchingDataInBackground();
            };

            ConfigurationChanged += (o, e) =>
            {
                controller.UpdateConfiguration(Configuration);
                settingsController.UpdateConfiguration(Configuration);
            };

            View = new GraphView()
            {
                DataContext = controller.ViewModel
            };
            SettingsView = new GraphSettingsView()
            {
                DataContext = settingsController.GraphSettingsViewModel
            };
        }
예제 #2
0
	    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();
		}
예제 #3
0
 protected void NewController()
 {
     controller = new GraphController(graph, downloadStringServiceFake.Object, timerFake.Object, graphConfig.Configuration, progressBarServiceFake.Object);
 }