Example #1
0
        public NozzleOffsetTemplateWidget(double[] activeOffsets, FlowDirection direction, ThemeConfig theme)
            : base(direction)
        {
            this.theme = theme;

            if (direction == FlowDirection.LeftToRight)
            {
                this.HAnchor = HAnchor.Stretch;
                this.VAnchor = VAnchor.Absolute;
                this.Height  = 110;
            }
            else
            {
                this.HAnchor = HAnchor.Absolute;
                this.VAnchor = VAnchor.Stretch;
                this.Width   = 110;
            }

            for (var i = 0; i <= 40; i++)
            {
                var calibrationLine = new CalibrationLine(direction, (i % 5 == 0) ? i : -1, theme)
                {
                    // Margin = 1,
                    IsNegative  = i < 20,
                    OffsetIndex = i,
                };
                calibrationLine.Click += (s, e) =>
                {
                    if (activeLine != null)
                    {
                        activeLine.IsActive = false;
                    }

                    calibrationLine.IsActive = true;
                    activeLine        = calibrationLine;
                    this.ActiveOffset = activeOffsets[calibrationLine.OffsetIndex] * -1;
                };
                this.AddChild(calibrationLine);

                // Add spacers to stretch to size
                if (i < 40)
                {
                    if (this.FlowDirection == FlowDirection.LeftToRight)
                    {
                        this.AddChild(new HorizontalSpacer());
                    }
                    else
                    {
                        this.AddChild(new VerticalSpacer());
                    }
                }
            }
        }
 static CalibrationLine()
 {
     CalibrationLine.CreateGlyphs();
 }
Example #3
0
        static CalibrationLine()
        {
            int glyphCenter = glyphSize / 2;

            CalibrationLine.CreateGlyphs(glyphCenter);
        }