/// <summary> /// Creates a new instance of the <see cref="XContainer"/> class. /// </summary> /// <param name="factory">The project factory.</param> /// <param name="project">The new container owner project.</param> /// <param name="name">The new container name.</param> /// <returns>The new instance of the <see cref="XContainer"/>.</returns> private XContainer CreateGridTemplate(IProjectFactory factory, XProject project, string name) { var template = factory.GetTemplate(project, name); var style = project .StyleLibraries.FirstOrDefault(g => g.Name == "Template") .Items.FirstOrDefault(s => s.Name == "Grid"); var layer = template.Layers.FirstOrDefault(); var builder = layer.Shapes.ToBuilder(); var grid = XRectangle.Create( 0, 0, template.Width, template.Height, style, project.Options.PointShape); grid.IsStroked = true; grid.IsFilled = false; grid.IsGrid = true; grid.OffsetX = 30.0; grid.OffsetY = 30.0; grid.CellWidth = 30.0; grid.CellHeight = 30.0; grid.State.Flags &= ~ShapeStateFlags.Printable; builder.Add(grid); layer.Shapes = builder.ToImmutable(); return(template); }
/// <summary> /// Creates a new instance of the <see cref="XContainer"/> class. /// </summary> /// <param name="factory">The project factory.</param> /// <param name="project">The new container owner project.</param> /// <param name="name">The new container name.</param> /// <returns>The new instance of the <see cref="XContainer"/>.</returns> private XContainer CreateGridTemplate(IProjectFactory factory, XProject project, string name) { var template = factory.GetTemplate(project, name); var style = project .StyleLibraries.FirstOrDefault(g => g.Name == "Template") .Items.FirstOrDefault(s => s.Name == "Grid"); var layer = template.Layers.FirstOrDefault(); var builder = layer.Shapes.ToBuilder(); var grid = XRectangle.Create( 0, 0, template.Width, template.Height, style, project.Options.PointShape); grid.IsStroked = true; grid.IsFilled = false; grid.IsGrid = true; grid.OffsetX = 30.0; grid.OffsetY = 30.0; grid.CellWidth = 30.0; grid.CellHeight = 30.0; grid.State.Flags &= ~ShapeStateFlags.Printable; builder.Add(grid); layer.Shapes = builder.ToImmutable(); return template; }