private async void GetTargetProjectPlans() { if (TfsShared.Instance.TargetTestProject == null) { throw new NullReferenceException("Tfs Object is Null"); } List <TestObjectViewModel> plansCollection = await Task.Run(() => { var plans = TfsShared.Instance.TargetTestProject.TestPlans.Query("Select * From TestPlan"); List <TestObjectViewModel> rootItems = plans.Select(plan => new TestObjectViewModel(plan.RootSuite, false)).ToList(); App.Current.Dispatcher.Invoke(() => { TestPlans.Clear(); foreach (var p in rootItems) { TestPlans.Add(p); } }); return(rootItems); }); Working = false; }
public async void CreatePlan() { await Task.Factory.StartNew(() => { if (string.IsNullOrEmpty(TestPlanName)) { MessageBox.Show("Please enter valid test plan name", "Missing Value", MessageBoxButton.OK, MessageBoxImage.Error); return; } Working = true; ITestPlan plan = TfsShared.Instance.TargetTestProject.TestPlans.Create(); plan.Name = TestPlanName; plan.Save(); App.Current.Dispatcher.Invoke(() => { TestPlans.Add(new TestObjectViewModel(plan.RootSuite, false)); }); Working = false; }); }
private void InsertPlan(TestPlan Item) // 插入一条计划 { _TestPlans.Add(Item); cbPlanList.Items.Add(Item); cbPlanList.SelectedItem = Item; }