コード例 #1
0
        protected override void ProcessRecord()
        {
            var control = new PsStack();

            SetControlProps(control);

            control.MinWidth     = MinWidth;
            control.MaxWidth     = MaxWidth;
            control.MinHeight    = MinHeight;
            control.MaxHeight    = MaxHeight;
            control.BgColor      = BgColor;
            control.Border       = Border;
            control.BorderRadius = BorderRadius;
            control.BorderLeft   = BorderLeft;
            control.BorderRight  = BorderRight;
            control.BorderTop    = BorderTop;
            control.BorderBottom = BorderBottom;
            control.OnSubmit     = OnSubmit;

            if (HorizontalAlign.HasValue)
            {
                control.HorizontalAlign = HorizontalAlign.Value;
            }

            if (VerticalAlign.HasValue)
            {
                control.VerticalAlign = VerticalAlign.Value;
            }

            if (Gap.HasValue)
            {
                control.Gap = Gap.Value;
            }

            if (Horizontal.IsPresent)
            {
                control.Horizontal = Horizontal.ToBool();
            }

            if (VerticalFill.IsPresent)
            {
                control.VerticalFill = VerticalFill.ToBool();
            }

            if (Wrap.IsPresent)
            {
                control.Wrap = Wrap.ToBool();
            }

            if (ScrollX.IsPresent)
            {
                control.ScrollX = ScrollX.ToBool();
            }

            if (ScrollY.IsPresent)
            {
                control.ScrollY = ScrollY.ToBool();
            }

            if (Controls != null)
            {
                foreach (var childControl in Controls)
                {
                    control.Controls.Add(childControl);
                }
            }

            WriteObject(control);
        }