private void EditSectionBtn_Click(object sender, RoutedEventArgs e) { SectionViewModel sectionVM = dataGrid.SelectedItem as SectionViewModel; AddSection editSection = new AddSection(libraryItems, sectionVM.Name, sectionVM.Description, libraryItems.First(i => i.Id == sectionVM.LibraryId)); if (editSection.ShowDialog().Value) { string name = editSection.Name.Text; string description = editSection.Description.Text; LibraryViewModel model = editSection.SelectedItem; if (sectionVM != null && name != null && model != null) { Models.Section section = sectionController.GetById(sectionVM.Id); Library library = libraryController.GetById(model.Id); section.Name = sectionVM.Name = name; sectionVM.LibraryId = library.Id; section.Library = library; section.Description = sectionVM.Description = description; section.ModifiedOn = sectionVM.ModifiedOn = DateTime.Now; sectionController.Edit(section); } } }
protected override void OnActivate() { _rootDirectory.SetRootDirectoryFromCommandLineArgumentsIfExists(); SelectRootDirectory.Activate(); AddNotebook.Activate(); ListNotebooks.Activate(); AddSection.Activate(); AddPage.Activate(); ImageCarousel.Activate(); }
private void AddSectionBtn_Click(object sender, RoutedEventArgs e) { InitDataSource(ref sectionItems, Mapper.SectionsToSectionViewModels, sectionController.Get); AddSection addSection = new AddSection(libraryItems); if (addSection.ShowDialog().Value) { string name = addSection.Name.Text; string description = addSection.Description.Text; LibraryViewModel model = addSection.SelectedItem; if (name != null && model != null) { Library library = libraryController.GetById(model.Id); Models.Section section = new Models.Section(name, description, library); sectionController.Add(section); sectionItems.Add(Mapper.SectionToSectionViewModel(section)); return; } } }
private void SectionNameChanged([NotNull] object sender, [NotNull] TextChangedEventArgs e) { Debug.ArgumentNotNull(sender, nameof(sender)); Debug.ArgumentNotNull(e, nameof(e)); if (TemplateDesigner.IsModifiedTracking > 0) { return; } TemplateDesigner.SetModified(true); if (string.IsNullOrEmpty(SectionName.Text)) { return; } if (!IsLastSection()) { return; } var addField = new AddSection(); var context = new TemplateDesignerContext { TemplateDesigner = TemplateDesigner, Section = Section }; AppHost.Usage.ReportCommand(addField, context); addField.Execute(context); if (FieldStack.Children.Count == 0) { CreateEmpyField(); } }
public void RepeatedAndFrameLengthAndOneSectionSpecified_Builds(AddSection addSection) { var builder = new FrameBuilder() .AddFrame() .WithFrameLength(100) .WithRepeated(true); addSection(builder); Assert.DoesNotThrow(() => builder.Build()); }