private void New_Suit_Button_Click(object sender, RoutedEventArgs e) { TestSuitViewModel suitModel = new TestSuitViewModel(); suitModel.Name = "New Suit"; suitModel.Description = "New suit desc"; suitModel.IsSelected = true; this.viewModel.RoboViewModel.TestSuitCollection.Add(suitModel); }
private void New_DataSource_Button_Click(object sender, RoutedEventArgs e) { object element = this.viewModel.RoboViewModel.SelectedNode; if (element != null && element.GetType().Name.Equals("TestSuitViewModel")) { TestSuitViewModel elementModel = (TestSuitViewModel)element; DataSourceViewModel ds = new DataSourceViewModel(); ds.Name = "3rd Data Source"; ds.Description = "3rd DS desc"; elementModel.AllCollection.Add(ds); elementModel.IsExpanded = true; ds.IsSelected = true; } else { MessageBox.Show("Please select the suit under which new Data Source to be added.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private void New_App_Button_Click(object sender, RoutedEventArgs e) { object element = this.viewModel.RoboViewModel.SelectedNode; if (element != null && element.GetType().Name.Equals("TestSuitViewModel")) { TestSuitViewModel elementModel = (TestSuitViewModel)element; AppsViewModel app = new AppsViewModel(); app.Name = "3rd App"; app.Description = "3rd App desc"; elementModel.AllCollection.Add(app); elementModel.IsExpanded = true; app.IsSelected = true; } else { MessageBox.Show("Please select the suit under which new Web/App to be added.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning); } }
public bool Serialize(XmlTextWriter w, RoboViewModel robo) { this.writer = w; Type suitCollectionType = new ObservableCollection <TestSuitViewModel>().GetType(); Type sequenceCollectionType = new ObservableCollection <TestSequenceViewModel>().GetType(); Type stepCollectionType = new ObservableCollection <TestStepViewModel>().GetType(); Type appsCollectionType = new ObservableCollection <AppsViewModel>().GetType(); Type dataSourceCollectionType = new ObservableCollection <DataSourceViewModel>().GetType(); Type variableCollectionType = new ObservableCollection <VariableViewModel>().GetType(); Type stringType = string.Empty.GetType(); Type boolType = bool.TrueString.GetType(); Type intType = int.MinValue.GetType(); Type doubleType = double.MinValue.GetType(); Type suitType = new TestSuitViewModel().GetType(); Type seqType = new TestSequenceViewModel().GetType(); Type stepType = new TestStepViewModel().GetType(); Type appType = new AppsViewModel().GetType(); Type dsType = new DataSourceViewModel().GetType(); Type varType = new VariableViewModel().GetType(); Type[] types = { suitCollectionType, sequenceCollectionType, stepCollectionType, appsCollectionType, dataSourceCollectionType, variableCollectionType, stringType, boolType, intType, doubleType, suitType, seqType, stepType, appType, dsType, varType }; writer.WriteStartDocument(true); writer.Formatting = Formatting.Indented; writer.Indentation = 2; writer.WriteStartElement("Suits"); AppendNodeRobo(types, robo); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); return(true); }
internal static void DealWithTestSuitViewModel(TestSuitViewModel TSModel, Grid grid, TreeView TestCaseTreeView) { main_grid = grid; testCaseTreeView = TestCaseTreeView; string name = TSModel.Name; string desc = TSModel.Description; Label labelName = new Label(); labelName.Content = "Name"; addToGrid(main_grid, labelName, 0, true); TextBox txtName = new TextBox(); txtName.Text = name; txtName.Name = "Name"; addToGrid(main_grid, txtName, 1, false); Label labelDesc = new Label(); labelDesc.Content = "Description"; addToGrid(main_grid, labelDesc, 0, true); TextBox txtDesc = new TextBox(); txtDesc.TextWrapping = TextWrapping.Wrap; txtDesc.Name = "Description"; txtDesc.VerticalScrollBarVisibility = ScrollBarVisibility.Visible; txtDesc.MinHeight = 70; txtDesc.Text = desc; addToGrid(main_grid, txtDesc, 1, false); main_grid.LostFocus += new RoutedEventHandler(TestSuitDetailsEdited); }
private void MenuItem_Suit_Delete_Click(object sender, RoutedEventArgs e) { TestSuitViewModel suit = (TestSuitViewModel)((MenuItem)sender).DataContext; ((ObservableCollection <TestSuitViewModel>)TestCaseTreeView.ItemsSource).Remove(suit); }