private TemplateContainerViewModel?CreateDefaultTemplate(IContainerFactory containerFactory, ProjectContainerViewModel project, string name) { var factory = _serviceProvider.GetService <IViewModelFactory>(); if (factory is null) { return(null); } var template = containerFactory.GetTemplate(project, name); if (template is null) { return(null); } template.IsGridEnabled = false; template.IsBorderEnabled = false; template.GridOffsetLeft = 30.0; template.GridOffsetTop = 30.0; template.GridOffsetRight = -30.0; template.GridOffsetBottom = -30.0; template.GridCellWidth = 30.0; template.GridCellHeight = 30.0; template.GridStrokeColor = factory.CreateArgbColor(0xFF, 0xDE, 0xDE, 0xDE); template.GridStrokeThickness = 1.0; return(template); }
/// <summary> /// Creates a new instance of the <see cref="PageContainer"/> class. /// </summary> /// <param name="containerFactory">The container 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="PageContainer"/>.</returns> private IPageContainer CreateGridTemplate(IContainerFactory containerFactory, IProjectContainer project, string name) { var factory = _serviceProvider.GetService <IFactory>(); var template = containerFactory.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 = factory.CreateRectangleShape( 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); }
private IPageContainer CreateDefaultTemplate(IContainerFactory containerFactory, IProjectContainer project, string name) { var factory = _serviceProvider.GetService <IFactory>(); var template = containerFactory.GetTemplate(project, name); var style = factory.CreateShapeStyle("Default", 255, 222, 222, 222, 255, 222, 222, 222, 1.0); var layer = template.Layers.FirstOrDefault(); var builder = layer.Shapes.ToBuilder(); var grid = factory.CreateRectangleShape( 30.0, 30.0, template.Width - 30.0, template.Height - 30.0, style); 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); }
private IPageContainer CreateDefaultTemplate(IContainerFactory containerFactory, IProjectContainer project, string name) { var factory = _serviceProvider.GetService <IFactory>(); var template = containerFactory.GetTemplate(project, name); template.IsGridEnabled = true; template.IsBorderEnabled = true; template.GridOffsetLeft = 30.0; template.GridOffsetTop = 30.0; template.GridOffsetRight = -30.0; template.GridOffsetBottom = -30.0; template.GridCellWidth = 30.0; template.GridCellHeight = 30.0; template.GridStrokeColor = factory.CreateArgbColor(0xFF, 0xDE, 0xDE, 0xDE); template.GridStrokeThickness = 1.0; return(template); }