private void OnStatisticsWindowClosed(object sender, EventArgs e)
 {
     statisticsWindow.Closed -= OnStatisticsWindowClosed;
     statisticsWindow = null;
 }
        public void OpenStatistics()
        {
            StatisticsViewModel viewModel = new StatisticsViewModel(new RandomColorGenerator());
            foreach (ApplicationCountModel application in countingService.Applications())
                viewModel.AddApplication(application.Path, application.Count);

            foreach (FileCountModel file in countingService.Files())
                viewModel.AddFile(file.Path, file.Count);

            statisticsWindow = new StatisticsWindow();
            statisticsWindow.ViewModel = viewModel;
            statisticsWindow.Owner = configurationWindow;
            statisticsWindow.Closed += OnStatisticsWindowClosed;
            statisticsWindow.ShowDialog();
        }