private void MainWindowTestRuns_Loaded(object sensder, RoutedEventArgs e)
        {
            // Initial DB data retrieve
            Task task = Task.Factory.StartNew(() =>
            {
                TestRunProxyManager manager = new TestRunProxyManager();
                this.UITestRunList = new ObservableCollection<TestRunProxy>(manager.GetAll().OrderBy(x=>x.Name));
            });
            task.ContinueWith(next =>
            {
                // Update the main Thread as it is the owner of the UI elements
                this.Dispatcher.Invoke((Action)(() =>
                {
                    this.SetCurrentAccentColor();
                    this.TestRunListBox.ItemsSource = this.UITestRunList;

                    this.MainTable.Visibility = Visibility.Visible;
                    this.progressBar.Visibility = Visibility.Hidden;
                }));
            });
        }
        private void PromptDialog_Loaded(object sender, RoutedEventArgs e)
        {
            // Initial DB data retrieve
            Task task = Task.Factory.StartNew(() =>
            {
                TestRunProxyManager testRunManager = new TestRunProxyManager();
                this.TestRunProxy = testRunManager.GetById(RunId);

                ProjectProxyManager proxyManager = new ProjectProxyManager();
                this.ProjectProxyList = proxyManager.GetAll();
            });
            task.ContinueWith(next =>
            {
                // Update the main Thread as it is the owner of the UI elements
                this.Dispatcher.Invoke((Action)(() =>
                {
                    foreach (var testCase in this.TestRunProxy.TestCasesList)
                    {
                        ProjectProxy projectProxy = this.ProjectProxyList.Where(proj => proj.Areas.Any(a => a.ID == testCase.AreaID)).FirstOrDefault();
                        if (projectProxy != null)
                        {
                            AreaProxy areaProxy = projectProxy.Areas.Where(a => a.ID == testCase.AreaID).FirstOrDefault();
                            if (areaProxy != null)
                            {
                                TestCaseProxy testCaseToRemove = areaProxy.TestCasesList.Where(tc => tc.Id == testCase.Id).FirstOrDefault();
                                if (testCaseToRemove != null)
                                    areaProxy.TestCasesList.Remove(testCaseToRemove);
                            }
                        }
                    }

                    this.SetCurrentAccentColor();
                    this.ProjectTreeView.ItemsSource = this.ProjectProxyList;

                    this.TestCasesList = this.TestRunProxy.TestCasesList;
                    this.SelectedTestCasesList.ItemsSource = this.TestCasesList;

                    this.TestRunList.Visibility = Visibility.Visible;
                    this.progressBar.Visibility = Visibility.Hidden;

                }));
            });
        }
        private void UpdateTestRun(TestRunProxy selectedTestRun)
        {
            TestRunProxyManager manager = new TestRunProxyManager();
            TestRunProxy updatedTestRun = manager.GetById(selectedTestRun.ID);

            selectedTestRun.TestCasesList = updatedTestRun.TestCasesList;
            this.OnSelectedItem(this, null);
        }
        private void PromptDialog_Loaded(object sender, RoutedEventArgs e)
        {
            // Initial DB data retrieve
            Task task = Task.Factory.StartNew(() =>
            {
                TestRunProxyManager testRunManager = new TestRunProxyManager();
                this.TestRunProxy = testRunManager.GetById(RunId);
            });
            task.ContinueWith(next =>
            {
                // Update the main Thread as it is the owner of the UI elements
                this.Dispatcher.Invoke((Action)(() =>
                {
                    this.SetCurrentAccentColor();
                    this.CurrentTestCaseLabel.Content = string.Format("1/{0}", this.TestRunProxy.TestCasesList.Count());

                    // Map to dictionary for easier manipulation
                    foreach (ExtendedTestCaseProxy testCase in this.TestRunProxy.TestCasesList)
                    {
                        runStatus[testCase] = testCase.Status;
                    }

                    // Starting run point
                    this.CurrentSelectedTestCase = this.TestRunProxy.TestCasesList.FirstOrDefault();
                    this.CurrentTestCaseIndex = 0; // Index
                    this.SetCurrentTestCase(CurrentSelectedTestCase);

                    this.runStatus[CurrentSelectedTestCase] = CurrentSelectedTestCase.Status;
                    this.StatusComboBox.SelectedIndex = (int)this.runStatus[CurrentSelectedTestCase];
                }));
            });
        }