Пример #1
0
        public static LayoutComponent CreateLayoutComponent(XDesign_DesignLayout xDesignLayout)
        {
            var result = LayoutComponent.Create(
                xDesignLayout.layoutCategory ?? Constants.DefaultComponentCategory,
                xDesignLayout.layoutName,
                CreateFabricStyleList(xDesignLayout.fabricStyles),
                xDesignLayout.rowCount,
                xDesignLayout.columnCount,
                xDesignLayout.blockCount);

            return(result);
        }
Пример #2
0
        public static Design CreateEmptyDesign()
        {
            var fabricStyles = new FabricStyleList();

            var design = new Design()
            {
                Width  = new Dimension(48, DimensionUnits.Inch),
                Height = new Dimension(48, DimensionUnits.Inch)
            };

            var component = LayoutComponent.Create("Standard", "Quilt Layout", fabricStyles, 3, 3, 2);

            design.LayoutComponent = component;

            return(design);
        }
Пример #3
0
        public async Task <string> CreateDesignAsync(string userId, string designName)
        {
            using var log = BeginFunction(nameof(DesignUserService), nameof(CreateDesignAsync), userId, designName);
            try
            {
                await Assert(SecurityPolicy.IsAuthorized, userId).ConfigureAwait(false);

                var fabricStyles = new FabricStyleList
                {
                    new FabricStyle(FabricStyle.UNKNOWN_SKU, Color.Red),
                    new FabricStyle(FabricStyle.UNKNOWN_SKU, Color.Green),
                    new FabricStyle(FabricStyle.UNKNOWN_SKU, Color.Blue)
                };

                var provider = new BuiltInQuiltLayoutComponenProvider();
                var entry    = provider.GetComponent(LayoutComponent.TypeName, Constants.DefaultComponentCategory, BuiltInQuiltLayoutComponenProvider.ComponentName_Checkerboard);

                var design = new Design.Core.Design()
                {
                    Width  = new Dimension(48, DimensionUnits.Inch),
                    Height = new Dimension(48, DimensionUnits.Inch)
                };

                var component = LayoutComponent.Create(entry.Category, entry.Name, fabricStyles, 3, 3, entry.BlockCount);
                design.LayoutComponent = component;

                var ownerReference = CreateOwnerReference.FromUserId(userId);
                var ownerId        = await DesignMicroService.AllocateOwnerAsync(ownerReference).ConfigureAwait(false);

                var mDesignSpecification = BusinessDataFactory.Create_MDesign_DesignSpecification(design);

                var id = await DesignMicroService.CreateDesignAsync(ownerId, designName, mDesignSpecification, GetUtcNow()).ConfigureAwait(false);

                var result = id.ToString();

                log.Result(result);
                return(result);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
                throw;
            }
        }
Пример #4
0
        public async Task <XDesign_Layout[]> GetLayoutsAsync(int rowCount, int columnCount, int size)
        {
            using var log = BeginFunction(nameof(DesignAjaxService), nameof(GetLayoutsAsync));
            try
            {
                await Task.CompletedTask.ConfigureAwait(false);

                var layoutList = new List <XDesign_Layout>();

                var provider = new BuiltInQuiltLayoutComponenProvider();
                foreach (var entry in provider.GetComponents(LayoutComponent.TypeName, Constants.DefaultComponentCategory))
                {
                    var fabricStyles = new FabricStyleList
                    {
                        new FabricStyle(FabricStyle.UNKNOWN_SKU, Color.Red),
                        new FabricStyle(FabricStyle.UNKNOWN_SKU, Color.Green),
                        new FabricStyle(FabricStyle.UNKNOWN_SKU, Color.Blue)
                    };

                    var component = LayoutComponent.Create(entry.Category, entry.Name, fabricStyles, rowCount, columnCount, entry.BlockCount);

                    var data = Create.XDesign_Layout(component, size);
                    layoutList.Add(data);
                }

                var result = layoutList.ToArray();

                log.Result(result);
                return(result);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
                throw;
            }
        }