Пример #1
0
        public MainViewModel(ViewController viewController, DialogService dialogs, BackgroundExecution backgroundExecution,
                             Analyzer analyzer,
                             Project lastKnownProject)
        {
            _tabManager     = new TabManager(this);
            _viewController = viewController;
            _analyzer       = analyzer;
            _dialogs        = dialogs;

            _backgroundExecution = backgroundExecution;

            LoadProjectCommand       = new DelegateCommand(LoadProjectClick);
            NewProjectCommand        = new DelegateCommand(NewProjectClick);
            SetupCommand             = new DelegateCommand(SetupClick);
            UpdateCommand            = new DelegateCommand(UpdateClick);
            FragmentationCommand     = new DelegateCommand(FragmentationClick);
            LoadDataCommand          = new DelegateCommand(LoadDataClick);
            SaveDataCommand          = new DelegateCommand(SaveDataClick);
            SummaryCommand           = new DelegateCommand(SummaryClick);
            CommentsCommand          = new DelegateCommand(CommentsClick);
            KnowledgeCommand         = new DelegateCommand(KnowledgeClick);
            KnowledgeLossCommand     = new DelegateCommand(KnowledgeLossClick);
            HotspotsCommand          = new DelegateCommand(HotspotsClick);
            CodeAgeCommand           = new DelegateCommand(CodeAgeClick);
            ChangeCouplingCommand    = new DelegateCommand(ChangeCouplingClick);
            AboutCommand             = new DelegateCommand(AboutClick);
            PredictHotspotsCommand   = new DelegateCommand(PredictHotspotsClick);
            EditColorsCommand        = new DelegateCommand(EditColorsClick);
            ToggleDisplayModeCommand = new DelegateCommand(ToggleDisplayModeClick);

            SetActiveProject(lastKnownProject);
        }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();

            // Last know project
            var project = Application.Current.Properties["project"] as Project;

            var viewController      = new ViewController(this);
            var analyzer            = new Analyzer(project); // TODO create on the fly?
            var dialogs             = new DialogService();
            var progressService     = new ProgressService(this);
            var backgroundExecution = new BackgroundExecution(progressService, dialogs);

            // TODO too much
            var mainViewModel = new MainViewModel(viewController, dialogs, project, analyzer, backgroundExecution);

            DataContext = mainViewModel;
        }
Пример #3
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            // Load thresholds from config file

            // Summary
            Thresholds.MaxWorkItemsPerCommitForSummary = Settings.Default.MaxWorkItemsPerCommitForSummary;

            // Hotspots
            Thresholds.MinCommitsForHotspots    = Settings.Default.MinCommitsForHotspots;
            Thresholds.MinLinesOfCodeForHotspot = Settings.Default.MinLinesOfCodeForHotspot;

            // Coupling
            Thresholds.MinCouplingForChangeCoupling         = Settings.Default.MinCouplingForChangeCoupling;
            Thresholds.MaxItemsInChangesetForChangeCoupling = Settings.Default.MaxItemsInChangesetForChangeCoupling;
            Thresholds.MinDegreeForChangeCoupling           = Settings.Default.MinDegreeForChangeCoupling;

            //Current.Properties.Add("lastKnownProject", Settings.Default.LastKnownProject);
            // var lastKnownProject = Application.Current.Properties["lastKnownProject"] as string;

            var lastKnownProject = Settings.Default.LastKnownProject;

            var analyzer = new Analyzer(new MetricProvider(), Project.GetSupportedFileTypesForAnalysis());

            // If there is an last project load it immediately
            var project = new Project();

            if (!string.IsNullOrEmpty(lastKnownProject) && File.Exists(lastKnownProject))
            {
                project = new Project();
                project.Load(lastKnownProject);
            }

            var mainWindow          = new MainWindow();
            var viewController      = new ViewController(mainWindow);
            var progressService     = new ProgressService(mainWindow);
            var dialogs             = new DialogService();
            var backgroundExecution = new BackgroundExecution(progressService, dialogs);


            var mainViewModel = new MainViewModel(viewController, dialogs, backgroundExecution, analyzer, project);

            mainWindow.DataContext = mainViewModel;
            mainWindow.Show();
        }
Пример #4
0
        public MainViewModel(ViewController viewController, DialogService dialogs, Project project, Analyzer analyzer, BackgroundExecution backgroundExecution)
        {
            _tabBuilder          = new TabBuilder(this);
            _viewController      = viewController;
            _dialogs             = dialogs;
            _project             = project;
            _analyzer            = analyzer;
            _backgroundExecution = backgroundExecution;

            SetupCommand           = new DelegateCommand(SetupClick);
            UpdateCommand          = new DelegateCommand(UpdateClick);
            FragmentationCommand   = new DelegateCommand(FragmentationClick);
            LoadDataCommand        = new DelegateCommand(LoadDataClick);
            SaveDataCommand        = new DelegateCommand(SaveDataClick);
            SummaryCommand         = new DelegateCommand(SummaryClick);
            CommentsCommand        = new DelegateCommand(CommentsClick);
            KnowledgeCommand       = new DelegateCommand(KnowledgeClick);
            KnowledgeLossCommand   = new DelegateCommand(KnowledgeLossClick);
            HotspotsCommand        = new DelegateCommand(HotspotsClick);
            CodeAgeCommand         = new DelegateCommand(CodeAgeClick);
            ChangeCouplingCommand  = new DelegateCommand(ChangeCouplingClick);
            AboutCommand           = new DelegateCommand(AboutClick);
            PredictHotspotsCommand = new DelegateCommand(PredictHotspotsClick);
        }