private void RemovePage(EditablePage page) { var pageItem = GetPageItem(page); Items.Remove(pageItem); RefreshNames(); }
private void HandlePageUrlSegment(EditablePage editablePage) { var oldSegment = OldPageUrlSegment.Value; var newSegment = PageUrlSegment.Text; if (newSegment == oldSegment) { return; } editablePage.SetPageUrl(newSegment); }
private PageItem GetPageItem(EditablePage model) { foreach (var item in Items) { var pageItem = item as PageItem; if (pageItem?.Model == model) { return(pageItem); } } return(null); }
private void AddPage() { var pageModel = new EditablePage { Layout = AlbumLayoutType.Layout1 }; if (Album.SelectedPage != null) { var index = Album.Pages.IndexOf(Album.SelectedPage); Album.Pages.Insert(index + 1, pageModel); } else { Album.Pages.Add(pageModel); } }
private void InsertPage(int index, EditablePage page) { var pageItem = new PageItem { Model = page, IsSelected = true }; Items.Insert(index, pageItem); if (page.Pictures.Count > 0) { foreach (var picture in page.Pictures) { pageItem.AddPicture(picture); } } RefreshNames(); }
private void SavePropertiesForPage(EditablePage editablePage) { editablePage.PageName = ((StringProperty)PageName.PropertyValue).Value; editablePage.SetStartPublish(((UniversalDateTimeProperty)StartPublishDate.PropertyValue).Value); editablePage.SetStopPublish(((UniversalDateTimeProperty)StopPublishDate.PropertyValue).Value); editablePage.SetVisibleInMenu(((BooleanProperty)VisibleInMenu.PropertyValue).Value); editablePage.SetVisibleInSiteMap(((BooleanProperty)VisibleInSitemap.PropertyValue).Value); editablePage.SetChildSortDirection(int.Parse(ChildSortDirection.SelectedValue)); editablePage.SetChildSortOrder(int.Parse(ChildSortOrder.SelectedValue)); HandlePageUrlSegment(editablePage); foreach (var propertyControl in _controls) { var propertyName = propertyControl.PropertyName; var propertyValue = propertyControl.PropertyValue; editablePage.SetProperty(propertyName, propertyValue); } editablePage.Save(); }
public EditablePage SavePage(string name, string content, string currentUser) { var existing = _connection.EditablePages.FirstOrDefault(page => page.Name == name); if (existing != null) { existing.Content = content; existing.UpdatedBy = currentUser; existing.LastUpdated = DateTime.Now; _connection.Update(existing); return(existing); } var editablePage = new EditablePage { Name = name, Content = content, LastUpdated = DateTime.Now, UpdatedBy = currentUser }; _connection.Insert(editablePage); return(editablePage); }
private void HandlePageUrlSegment(EditablePage editablePage) { var oldSegment = OldPageUrlSegment.Value; var newSegment = PageUrlSegment.Text; if (newSegment == oldSegment) { return; } editablePage.SetPageUrl(newSegment); }
private void SavePropertiesForPage(EditablePage editablePage) { editablePage.PageName = ((StringProperty)PageName.PropertyValue).Value; editablePage.SetStartPublish(((DateTimeProperty)StartPublishDate.PropertyValue).Value); editablePage.SetStopPublish(((DateTimeProperty)StopPublishDate.PropertyValue).Value); editablePage.SetVisibleInMenu(((BooleanProperty) VisibleInMenu.PropertyValue).Value); editablePage.SetVisibleInSiteMap(((BooleanProperty)VisibleInSitemap.PropertyValue).Value); editablePage.SetChildSortDirection(int.Parse(ChildSortDirection.SelectedValue)); editablePage.SetChildSortOrder(int.Parse(ChildSortOrder.SelectedValue)); HandlePageUrlSegment(editablePage); foreach (var propertyControl in _controls) { var propertyName = propertyControl.PropertyName; var propertyValue = propertyControl.PropertyValue; editablePage.SetProperty(propertyName, propertyValue); } editablePage.Save(); }
public EditModel() { Page = new EditablePage(); }