private void SaveItemAppBarButton_Click(object sender, EventArgs e) { // Confirm a title is provided if (titleTextBox.Text.Length == 0) { MessageBox.Show("Please give your idea a name."); return; } else { (DataContext as IdeaViewModel).SelectedIdea.Title = titleTextBox.Text; // Save title (DataContext as IdeaViewModel).SelectedIdea.Overview = overviewTextBox1.Text; // overview (DataContext as IdeaViewModel).SelectedIdea.Notes = notesTextBox.Text; // and notes //// If the system requirements textbox isn't empty, save that if (systemReqsTextBox.Text != "") { string reqTitle = systemReqsTextBox.Text; var req = new SystemRequirement() { Requirement = reqTitle }; (DataContext as IdeaViewModel).AddRequirement(req); } // same thing for use cases if (useCaseTextBox.Text != "") { string ucTitle = useCaseTextBox.Text; var uc = new UseCase() { UCase = ucTitle }; (DataContext as IdeaViewModel).AddUseCase(uc); } } lastSelectedIdea = (DataContext as IdeaViewModel).SelectedIdea; (DataContext as IdeaViewModel).SaveIdeasToDB(); NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); }
private void OnUseCaseRemoved(UseCase uc) { uc.Idea = null; }
private void addUseCaseButton_Click(object sender, RoutedEventArgs e) { string ucTitle = useCaseTextBox.Text; if (ucTitle != "") { var uc = new UseCase() { UCase = ucTitle }; (DataContext as IdeaViewModel).AddUseCase(uc); } useCaseTextBox.Text = ""; }
private void OnUseCaseAdded(UseCase uc) { uc.Idea = this; }
private void detach_UseCase(UseCase uc) { NotifyPropertyChanging("Idea"); }
private void attach_UseCase(UseCase newUseCase) { NotifyPropertyChanging("Idea"); }
public void RemoveSelectedUseCase(UseCase ucForDelete) { // Remove from the data table _DB.UseCases.DeleteOnSubmit(ucForDelete); _DB.SubmitChanges(); // Remove from the entity set SelectedIdea.UseCases.Remove(ucForDelete); // Remove from the observable collection SelectedIdea.UseCaseOC.Remove(ucForDelete); }
public void AddUseCase(UseCase uc) { // Set the idea context to the appropriate idea uc.Idea = SelectedIdea; // Add to the entity set SelectedIdea.UseCases.Add(uc); // Add to UseCases datatable _DB.UseCases.InsertOnSubmit(uc); // Add to the observable collection SelectedIdea.UseCaseOC.Add(uc); // Save the data context _DB.SubmitChanges(); }