public void Initialize()
        {
            _viewModel = CreateViewModel();
            _container.RegisterInstance(_viewModel);

            var region = _regionManager.Regions[RegionNames.MainContent];
            var view = _container.Resolve<TestResultsView>();

            region.Add(view);
            region.Activate(view);

            _eventAggregator.GetEvent<ShowTestResultsEvent>().Subscribe(arg => region.Activate(view), ThreadOption.UIThread, true);
        }
        private TestResultsViewModel CreateViewModel()
        {
            var viewModel = new TestResultsViewModel
                {
                    ShowPassed = true,
                    ShowFailed = true,
                    IsRunning = false,
                };
            _testResultsViews = new List<ICollectionView>();

            List<DriverType> enabledBrowsers;

            try
            {
                // TODO: Create a settings service and store the client browser settings there.
                enabledBrowsers = JsonConvert.DeserializeObject<List<DriverType>>(_settingsService.GetEnabledBrowsers())
                    ?? new List<DriverType> { DriverType.PhantomJs };
            }
            catch
            {
                enabledBrowsers = new List<DriverType> { DriverType.PhantomJs };
            }

            foreach (var browser in enabledBrowsers)
            {
                switch (browser)
                {
                    case DriverType.PhantomJs:
                        viewModel.UsePhantomJs = true;
                        break;

                    case DriverType.Firefox:
                        viewModel.UseFirefox = true;
                        break;

                    case DriverType.Chrome:
                        viewModel.UseChrome = true;
                        break;

                    case DriverType.InternetExplorer:
                        viewModel.UseInternetExplorer = true;
                        break;
                }
            }

            viewModel.RunTestsCommand = new DelegateCommand(RunTests, () => AnyBrowserEnabled && !_viewModel.IsRunning);
            viewModel.CancelTestRunCommand = new DelegateCommand(CancelTestRun, () => viewModel.IsRunning && !_isCancelRequested);
            viewModel.ExportToClipboardCommand = new DelegateCommand(ExportToClipboard, () => !_viewModel.IsRunning);

            viewModel.EnabledBrowsersChangedCommand = new DelegateCommand(SaveEnabledBrowsers);
            viewModel.TestResultsFilterChangedCommand = new DelegateCommand(UpdateFilters);

            return viewModel;
        }
        public TestResultsView(TestResultsViewModel viewModel)
        {
            InitializeComponent();

            DataContext = viewModel;
        }