Esempio n. 1
0
        protected override void OnPostPaint(NPaintVisitor visitor)
        {
            base.OnPostPaint(visitor);

            if (String.IsNullOrEmpty(m_Status))
            {
                return;
            }

            visitor.ClearStyles();
            visitor.SetFont(Font);

            // Determine status bounds
            NRectangle contentArea  = GetContentEdge();
            double     length       = NMath.Max(contentArea.Width, contentArea.Height) * 0.3;
            NRectangle statusBounds = new NRectangle(contentArea.Right - length - 5,
                                                     contentArea.Top + 5, length, length);

            // Fill the status bounds with a circle
            NExamplesHomePage homePage = (NExamplesHomePage)GetFirstAncestor(NExamplesHomePage.NExamplesHomePageSchema);
            NColor            color    = homePage.GetStatusColor(m_Status);

            visitor.SetFill(new NColor(color, 160));
            visitor.PaintEllipse(statusBounds);

            // Create text paint settings
            NPaintTextRectSettings settings = new NPaintTextRectSettings();

            settings.HorzAlign = ENTextHorzAlign.Center;
            settings.VertAlign = ENTextVertAlign.Center;

            // Paint the status text in the top right corner
            visitor.SetFill(NColor.White);
            visitor.PaintString(statusBounds, m_Status, ref settings);
        }
        private void OnHexagonColorPickerSelectedIndexChanged(NValueChangeEventArgs arg)
        {
            NHexagonColorPicker colorPicker = (NHexagonColorPicker)arg.TargetNode;
            NColor selectedColor            = colorPicker.SelectedColor;

            m_EventsLog.LogEvent(selectedColor.GetHEX().ToUpper());
        }
Esempio n. 3
0
        /// <summary>
        /// Performs the element post-children custom paint. Overriden to paint the status
        /// of this example tile (if it has one) in its bottom-left corner.
        /// </summary>
        /// <param name="visitor"></param>
        protected override void OnPostPaint(NPaintVisitor visitor)
        {
            base.OnPostPaint(visitor);

            if (String.IsNullOrEmpty(m_Status))
            {
                return;
            }

            // Paint a new label in the bottom left corner
            NRectangle bounds = GetContentEdge();

            NFont font = new NFont(FontName, 5.0, ENFontStyle.Regular);

            font.RasterizationMode = ENFontRasterizationMode.Aliased;
            NSize      textSize = font.MeasureString(m_Status, this.OwnerDocument);
            NRectangle textRect = new NRectangle(bounds.X - 1, bounds.Bottom - textSize.Height,
                                                 textSize.Width + 3, textSize.Height);

            // Paint the text background
            NColor color = HomePage.GetStatusColor(m_Status);

            visitor.SetFill(color);
            visitor.PaintRectangle(textRect);

            // Paint the text
            visitor.SetFill(NColor.White);
            visitor.SetFont(font);

            NPoint location = textRect.Location;
            NPaintTextPointSettings settings = new NPaintTextPointSettings();

            visitor.PaintString(location, m_Status, ref settings);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates the NOV description label placed in the header.
        /// </summary>
        /// <returns></returns>
        private NLabel CreateHeaderLabel()
        {
            NColor transparentWhite     = new NColor(NColor.White, 0);
            NColor textColor            = NExamplesHomePage.HeaderColor;
            NColor transparentTextColor = new NColor(textColor, 0);

            NLabel headerLabel = new NLabel("Enterprise-grade UI controls suite for .NET development on Windows and Mac");

            // Background and border
            headerLabel.BackgroundFill = new NLinearGradientFill(NAngle.Zero, new NColor[] {
                transparentWhite, NColor.White, NColor.White, transparentWhite
            });

            NBorder border = new NBorder();

            border.TopSide = new NBorderSide(new NLinearGradientFill(NAngle.Zero, new NColor[] {
                transparentTextColor, textColor, textColor, transparentTextColor
            }));
            border.BottomSide = new NBorderSide(new NLinearGradientFill(NAngle.Zero, new NColor[] {
                transparentTextColor, textColor, transparentTextColor
            }));
            headerLabel.Border          = border;
            headerLabel.BorderThickness = new NMargins(0, 1, 0, 1);

            // Text style
            headerLabel.TextFill = new NColorFill(textColor);
            headerLabel.Font     = new NFont(NFontDescriptor.DefaultSansFamilyName, HeaderFontSize);

            // Box model
            headerLabel.Padding             = new NMargins(0, LaneSpacing);
            headerLabel.HorizontalPlacement = ENHorizontalPlacement.Center;

            return(headerLabel);
        }
Esempio n. 5
0
        /// <summary>
        /// Parses the background colors of the status labels defined in the examples XML file.
        /// </summary>
        /// <param name="styleElement"></param>
        private void ParseStatusColors(NXmlElement styleElement)
        {
            m_StatusColorMap = new NMap <string, NColor>();
            if (styleElement == null)
            {
                return;
            }

            for (int i = 0, count = styleElement.ChildrenCount; i < count; i++)
            {
                NXmlElement child = styleElement.GetChildAt(i) as NXmlElement;
                if (child == null || child.Name != "status")
                {
                    continue;
                }

                // Get the status name
                string name = child.GetAttributeValue("name");
                if (name == null)
                {
                    continue;
                }

                // Parse the status color
                string colorStr = child.GetAttributeValue("color");
                NColor color;
                if (NColor.TryParse(colorStr, out color) == false)
                {
                    continue;
                }

                // Add the name/color pair to the status color map
                m_StatusColorMap.Set(name, color);
            }
        }
        private void OnSelectedIndexChanged(NValueChangeEventArgs args)
        {
            NPaletteColorPicker colorPicker = (NPaletteColorPicker)args.TargetNode;
            NColor selectedColor            = colorPicker.SelectedColor;

            m_EventsLog.LogEvent(selectedColor.GetHEX().ToUpper());
        }
Esempio n. 7
0
        /// <summary>
        /// Creates a stack panel for the given row element. Row elements can contain only
        /// group elements and label elements.
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        private NStackPanel CreateRow(NXmlElement row, NColor categoryColor)
        {
            NStackPanel stack = new NStackPanel();

            stack.Direction         = ENHVDirection.LeftToRight;
            stack.FillMode          = ENStackFillMode.Equal;    // FIX: make this a setting
            stack.HorizontalSpacing = GroupHorizontalSpacing;
            stack.Padding           = new NMargins(GroupHorizontalSpacing, 0);

            for (int i = 0, count = row.ChildrenCount; i < count; i++)
            {
                NXmlElement child = row.GetChildAt(i) as NXmlElement;
                if (child == null)
                {
                    continue;
                }

                switch (child.Name)
                {
                case "group":
                    stack.Add(CreateGroup(child, categoryColor));
                    break;

                case "label":
                    stack.Add(CreateLabel(child));
                    break;

                default:
                    throw new Exception("Unsuppoted row child element");
                }
            }

            return(stack);
        }
Esempio n. 8
0
        public static Color ToColorT(object value)
        {
            if (value is Color)
            {
                return((Color)value);
            }

            if (value is int)
            {
                return(NColor.ColorFromUInt32(0xFF000000 | (uint)(int)value));
            }

            if (value is uint)
            {
                return(NColor.ColorFromUInt32((uint)value));
            }

            var s = value as string;

            if (s != null)
            {
                return(NColor.Parse(s));
            }

            throw new InvalidCastException();
        }
        private NLineSeries CreateLineSeries(NColor lightColor, NColor color, int begin, int end)
        {
            // Add a line series
            NLineSeries line = new NLineSeries();

            for (int i = 0; i < 5; i++)
            {
                line.DataPoints.Add(new NLineDataPoint(m_Random.Next(begin, end)));
            }

            line.Stroke = new NStroke(2, color);

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Format = "<value>";
            dataLabelStyle.TextStyle.Background.Visible = false;
            dataLabelStyle.ArrowStroke.Width            = 0;
            dataLabelStyle.ArrowLength    = 10;
            dataLabelStyle.TextStyle.Font = new NFont("Arial", 8);
            dataLabelStyle.TextStyle.Background.Visible = true;

            line.DataLabelStyle = dataLabelStyle;

            NMarkerStyle markerStyle = new NMarkerStyle();

            markerStyle.Visible = true;
            markerStyle.Border  = new NStroke(color);
            markerStyle.Fill    = new NColorFill(lightColor);
            markerStyle.Shape   = ENPointShape.Ellipse;
            markerStyle.Size    = new NSize(5, 5);

            line.MarkerStyle = markerStyle;

            return(line);
        }
Esempio n. 10
0
        /// <summary>
        /// Creates a group box for the given group element or a directly a table panel if the
        /// given group element does not have a name. Group elements can contain only tile
        /// elements, label elements and other group elements.
        /// </summary>
        /// <param name="group"></param>
        /// <param name="borderColor"></param>
        /// <returns></returns>
        private NWidget CreateGroup(NXmlElement group, NColor borderColor)
        {
            // Create a table panel
            NTableFlowPanel tablePanel = CreateTablePanel(group, borderColor);

            // Get the group title
            string groupTitle = group.GetAttributeValue("name");

            if (String.IsNullOrEmpty(groupTitle))
            {
                return(tablePanel);
            }

            // Create a group box
            NLabel    headerLabel = new NLabel(groupTitle);
            NGroupBox groupBox    = new NGroupBox(headerLabel);

            groupBox.Header.HorizontalPlacement = ENHorizontalPlacement.Center;
            groupBox.Padding = new NMargins(ItemVerticalSpacing);
            groupBox.Border  = NBorder.CreateFilledBorder(borderColor);

            // Create the table panel with the examples tiles
            groupBox.Content = CreateTablePanel(group, borderColor);

            return(groupBox);
        }
        private void ApplyInterlaceStyles()
        {
            NLegendInterlaceStylesCollection interlaceStyles = new NLegendInterlaceStylesCollection();

            if (m_HorizontalInterlaceStripesCheckBox.Checked)
            {
                NLegendInterlaceStyle horzInterlaceStyle = new NLegendInterlaceStyle();
                horzInterlaceStyle.Fill     = new NColorFill(NColor.FromColor(NColor.LightBlue, 0.5f));
                horzInterlaceStyle.Type     = ENLegendInterlaceStyleType.Row;
                horzInterlaceStyle.Length   = 1;
                horzInterlaceStyle.Interval = 1;

                interlaceStyles.Add(horzInterlaceStyle);
            }

            if (m_VerticalInterlaceStripesCheckBox.Checked)
            {
                NLegendInterlaceStyle vertInterlaceStyle = new NLegendInterlaceStyle();
                vertInterlaceStyle.Fill     = new NColorFill(NColor.FromColor(NColor.DarkGray, 0.5f));
                vertInterlaceStyle.Type     = ENLegendInterlaceStyleType.Col;
                vertInterlaceStyle.Length   = 1;
                vertInterlaceStyle.Interval = 1;

                interlaceStyles.Add(vertInterlaceStyle);
            }

            m_Legend.InterlaceStyles = interlaceStyles;
        }
 public NItem(NImage image, NColor color, NFill fill, NStroke stroke)
 {
     Image  = image;
     Color  = color;
     Fill   = fill;
     Stroke = stroke;
 }
Esempio n. 13
0
        private void RecreateSymbols()
        {
            NColor color  = m_ColorBox.SelectedColor;
            double length = InitialSize * Math.Pow(2, m_RadioGroup.SelectedIndex);
            NSize  size   = new NSize(length, length);

            m_SymbolsTable.Clear();

            ENSymbolShape[] symbolShapes = NEnum.GetValues <ENSymbolShape>();
            int             count        = symbolShapes.Length / 2 + symbolShapes.Length % 2;

            for (int i = 0; i < count; i++)
            {
                // Add a symbol box to the first column
                int column1Index = i;
                AddSymbolBox(symbolShapes[column1Index], size, color);

                // Add a symbol box to the second column
                int column2Index = count + i;
                if (column2Index < symbolShapes.Length)
                {
                    NSymbolBox symbolBox = AddSymbolBox(symbolShapes[column2Index], size, color);
                    symbolBox.Margins = new NMargins(NDesign.HorizontalSpacing * 10, 0, 0, 0);
                }
            }
        }
Esempio n. 14
0
        private void nColorBoxControl5_SelectedColorChanged(Nevron.Nov.Dom.NValueChangeEventArgs arg)
        {
            checkBox3.Checked = true;
            NColor c = (Nevron.Nov.Graphics.NColor)arg.NewValue;

            Color_bar_drop_custom.Color = Color.FromArgb(c.R, c.G, c.B);
        }
Esempio n. 15
0
        private NStyleNode CreateStyleNode(NColor color)
        {
            NStyleNode styleNode = new NStyleNode();

            styleNode.ColorFill = new NColorFill(color);
            return(styleNode);
        }
Esempio n. 16
0
        private void AddAxis(string title)
        {
            NRadarAxis axis = new NRadarAxis();

            // set title
            axis.Title      = title;
            axis.TitleAngle = new NScaleLabelAngle(ENScaleLabelAngleMode.Scale, 0);
//			axis.TitleTextStyle.TextFormat = TextFormat.XML;

            // setup scale
            NLinearScale linearScale = (NLinearScale)axis.Scale;

            if (m_Chart.Axes.Count == 0)
            {
                // if the first axis then configure grid style and stripes
                linearScale.MajorGridLines.Stroke = new NStroke(1, NColor.Gainsboro, ENDashStyle.Dot);

                // add interlaced stripe
                NScaleStrip strip = new NScaleStrip();
                strip.Fill       = new NColorFill(NColor.FromRGBA(200, 200, 200, 64));
                strip.Interlaced = true;
                linearScale.Strips.Add(strip);
            }
            else
            {
                // hide labels
                linearScale.Labels.Visible = false;
            }

            m_Chart.Axes.Add(axis);
        }
Esempio n. 17
0
        /// <summary>
        /// Creates the product groups stack panel.
        /// </summary>
        /// <param name="root"></param>
        /// <returns></returns>
        private NStackPanel CreateProductGroupsStack(NXmlElement root)
        {
            NMap <string, NStackPanel> stackMap = new NMap <string, NStackPanel>();

            // Create the main stack
            NStackPanel mainStack = new NStackPanel();

            mainStack.Direction = ENHVDirection.LeftToRight;
            mainStack.Margins   = new NMargins(0, LaneSpacing * 2);

            // Create a stack panel for each license groups and add it to the main stack
            int count = root.ChildrenCount;

            for (int i = 0; i < count; i++)
            {
                NXmlElement categoryElement = root.GetChildAt(i) as NXmlElement;
                if (categoryElement == null)
                {
                    continue;
                }

                string license = categoryElement.GetAttributeValue("license");

                NStackPanel licenseGroupStack;
                if (!stackMap.TryGet(license, out licenseGroupStack))
                {
                    // A stack panel for the license group not found, so create one
                    licenseGroupStack = CreateProductGroupStack();
                    stackMap.Add(license, licenseGroupStack);

                    // Create a stack for the current group and its name
                    NStackPanel stack = new NStackPanel();
                    stack.Direction = ENHVDirection.TopToBottom;

                    // 1. Add the license group stack
                    stack.Add(licenseGroupStack);

                    // 2. Add the bracket
                    NColor  color   = NColor.Parse(categoryElement.GetAttributeValue("color"));
                    NWidget bracket = CreateLicenseGroupBracket(color);
                    stack.Add(bracket);

                    // 3. Add the label
                    NLabel label = new NLabel(license);
                    label.HorizontalPlacement = ENHorizontalPlacement.Center;
                    label.TextFill            = new NColorFill(color);
                    label.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, InfoFontSize);
                    stack.Add(label);

                    mainStack.Add(stack);
                }

                // Create an image box for the current category
                NImageBox imageBox = CreateImageBox(categoryElement);
                licenseGroupStack.Add(imageBox);
            }

            return(mainStack);
        }
Esempio n. 18
0
        protected override NWidget CreateExampleContent()
        {
            NStackPanel stack = new NStackPanel();

            NStackPanel controlStack = new NStackPanel();

            stack.Add(controlStack);

            NRadialGauge radialGauge = new NRadialGauge();

            radialGauge.PreferredSize       = defaultRadialGaugeSize;
            radialGauge.CapEffect           = new NGlassCapEffect();
            radialGauge.Dial                = new NDial(ENDialShape.Circle, new NEdgeDialRim());
            radialGauge.Dial.BackgroundFill = NAdvancedGradientFill.Create(ENAdvancedGradientColorScheme.Ocean2, 0);

            // configure scale
            NGaugeAxis axis = new NGaugeAxis();

            radialGauge.Axes.Add(axis);
            NLinearScale scale = axis.Scale as NLinearScale;

            scale.SetPredefinedScale(ENPredefinedScaleStyle.PresentationNoStroke);
            scale.Labels.OverlapResolveLayouts = new NDomArray <ENLevelLabelsLayout>();
            scale.MinorTickCount              = 3;
            scale.Ruler.Fill                  = new NColorFill(NColor.FromColor(NColor.White, 0.4f));
            scale.OuterMajorTicks.Fill        = new NColorFill(NColor.Orange);
            scale.Labels.Style.TextStyle.Font = new NFont("Arimo", 12.0, ENFontStyle.Bold | ENFontStyle.Italic);
            scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.White);

            m_Axis = (NGaugeAxis)radialGauge.Axes[0];

            controlStack.Add(radialGauge);

            m_Indicator1               = new NRangeIndicator();
            m_Indicator1.Value         = 50;
            m_Indicator1.Fill          = new NColorFill(NColor.LightBlue);
            m_Indicator1.Stroke.Color  = NColor.DarkBlue;
            m_Indicator1.EndWidth      = 20;
            m_Indicator1.AllowDragging = true;
            radialGauge.Indicators.Add(m_Indicator1);

            m_Indicator2               = new NNeedleValueIndicator();
            m_Indicator2.Value         = 79;
            m_Indicator2.Fill          = new NStockGradientFill(ENGradientStyle.Horizontal, ENGradientVariant.Variant1, NColor.White, NColor.Red);
            m_Indicator2.Stroke.Color  = NColor.Red;
            m_Indicator2.AllowDragging = true;
            radialGauge.Indicators.Add(m_Indicator2);

            m_Indicator3               = new NMarkerValueIndicator();
            m_Indicator3.Value         = 90;
            m_Indicator3.AllowDragging = true;
            radialGauge.Indicators.Add(m_Indicator3);

            radialGauge.SweepAngle = new NAngle(270.0, NUnit.Degree);

            return(stack);
        }
Esempio n. 19
0
 private void ColorSelector_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ColorSelector.SelectedItem != null)
     {
         NColor color = parent.ColorToNColor((Color)ColorSelector.SelectedItem);
         parent.ChangeTagColor(color.R, color.G, color.B);
         ColorSelectorDisplay.Text = parent.GetFormattedTagColor();
     }
 }
Esempio n. 20
0
        private NCartesianAxis CreateLinearAxis(ENCartesianAxisDockZone dockZone, NColor color)
        {
            NCartesianAxis axis = new NCartesianAxis();

            axis.Scale  = CreateLinearScale(color);
            axis.Anchor = new NDockCartesianAxisAnchor(dockZone);

            return(axis);
        }
Esempio n. 21
0
        /// <summary>
        /// Creates a left tag border with the specified border
        /// </summary>
        /// <param name="color"></param>
        /// <returns></returns>
        private static NBorder CreateLeftTagBorder(NColor color)
        {
            NBorder border = new NBorder();

            border.LeftSide      = new NBorderSide();
            border.LeftSide.Fill = new NColorFill(color);

            return(border);
        }
Esempio n. 22
0
        private void Ping(string[] parameters, ClientInfo sender)
        {
            Message m = new Message("Server", MessageType.Message);

            m.SetContent("Pong!");
            m.SetColor(NColor.FromRGB(0, 255, 21));

            sender.Send(m);
        }
Esempio n. 23
0
 private void ConfigureScale(NLinearScale scale)
 {
     scale.SetPredefinedScale(ENPredefinedScaleStyle.PresentationNoStroke);
     scale.Labels.OverlapResolveLayouts = new NDomArray <ENLevelLabelsLayout>();
     scale.MinorTickCount              = 3;
     scale.Ruler.Fill                  = new NColorFill(NColor.FromColor(NColor.White, 0.4f));
     scale.OuterMajorTicks.Fill        = new NColorFill(NColor.Orange);
     scale.Labels.Style.TextStyle.Font = new NFont("Arimo", 10.0, ENFontStyle.Bold);
     scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.White);
 }
        private NCustomScaleBreak CreateCustomScaleBreak(NColor color, NRange range)
        {
            NCustomScaleBreak scaleBreak = new NCustomScaleBreak();

            scaleBreak.Fill   = new NColorFill(new NColor(color, 124));
            scaleBreak.Length = 10;
            scaleBreak.Range  = range;

            return(scaleBreak);
        }
Esempio n. 25
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreatePolarChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Polar Area";

            // configure chart
            m_Chart = (NPolarChart)chartView.Surface.Charts[0];

            m_Chart.SetPredefinedPolarAxes(ENPredefinedPolarAxes.AngleValue);

            // setup polar axis
            NLinearScale linearScale = (NLinearScale)m_Chart.Axes[ENPolarAxis.PrimaryValue].Scale;

            linearScale.ViewRangeInflateMode  = ENScaleViewRangeInflateMode.MajorTick;
            linearScale.InflateViewRangeBegin = true;
            linearScale.InflateViewRangeEnd   = true;
            linearScale.MajorGridLines.Stroke = new NStroke(1, NColor.Black);

            NScaleStrip strip = new NScaleStrip();

            strip.Fill       = new NColorFill(NColor.FromColor(NColor.Beige, 0.5f));
            strip.Interlaced = true;
            linearScale.Strips.Add(strip);

            // setup polar angle axis
            NAngularScale angularScale = (NAngularScale)m_Chart.Axes[ENPolarAxis.PrimaryAngle].Scale;

            strip            = new NScaleStrip();
            strip.Fill       = new NColorFill(NColor.FromRGBA(192, 192, 192, 125));
            strip.Interlaced = true;
            angularScale.Strips.Add(strip);

            // polar area series 1
            NPolarAreaSeries series1 = new NPolarAreaSeries();

            m_Chart.Series.Add(series1);
            series1.Name           = "Theoretical";
            series1.DataLabelStyle = new NDataLabelStyle(false);
            GenerateData(series1, 100, 15.0);

            // polar area series 2
            NPolarAreaSeries series2 = new NPolarAreaSeries();

            m_Chart.Series.Add(series2);
            series2.Name           = "Experimental";
            series2.DataLabelStyle = new NDataLabelStyle(false);
            GenerateData(series2, 100, 10.0);

            // apply style sheet
            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
Esempio n. 26
0
        protected override NWidget CreateExampleContent()
        {
            double width = 1;
            NColor color = NColor.Black;

            m_arrStrokes = new NStroke[]
            {
                new NStroke(width, color, ENDashStyle.Solid),
                new NStroke(width, color, ENDashStyle.Dot),
                new NStroke(width, color, ENDashStyle.Dash),
                new NStroke(width, color, ENDashStyle.DashDot),
                new NStroke(width, color, ENDashStyle.DashDotDot),
                new NStroke(width, color, new NDashPattern(2, 2, 2, 2, 0, 2))
            };

            m_EditStroke          = new NStroke();
            m_EditStroke.Width    = width;
            m_EditStroke.Color    = color;
            m_EditStroke.DashCap  = ENLineCap.Square;
            m_EditStroke.StartCap = ENLineCap.Square;
            m_EditStroke.EndCap   = ENLineCap.Square;

            for (int i = 0; i < m_arrStrokes.Length; i++)
            {
                NStroke stroke = m_arrStrokes[i];
                stroke.DashCap  = m_EditStroke.DashCap;
                stroke.StartCap = m_EditStroke.StartCap;
                stroke.EndCap   = m_EditStroke.EndCap;
            }

            m_LabelFont = new NFont(NFontDescriptor.DefaultSansFamilyName, 12, ENFontStyle.Bold);
            m_LabelFill = new NColorFill(ENNamedColor.Black);

            m_CanvasStack          = new NStackPanel();
            m_CanvasStack.FillMode = ENStackFillMode.None;
            m_CanvasStack.FitMode  = ENStackFitMode.None;

            NSize preferredSize = GetCanvasPreferredSize(m_EditStroke.Width);

            for (int i = 0; i < m_arrStrokes.Length; i++)
            {
                NCanvas canvas = new NCanvas();
                canvas.PrePaint      += new Function <NCanvasPaintEventArgs>(OnCanvasPrePaint);
                canvas.PreferredSize  = preferredSize;
                canvas.Tag            = m_arrStrokes[i];
                canvas.BackgroundFill = new NColorFill(NColor.White);
                m_CanvasStack.Add(canvas);
            }

            // The stack must be scrollable
            NScrollContent scroll = new NScrollContent();

            scroll.Content = m_CanvasStack;
            return(scroll);
        }
 public AvatarDetailsHashable(AvatarDetailsData avatarDetails, string displayName, string context = "")
 {
     BodyColor    = avatarDetails.BodyColor;
     DisplayName  = displayName;
     Context      = context;
     EquipmentIds = new long[avatarDetails.Outfit.Length];
     for (int i = 0; i < EquipmentIds.Length; i++)
     {
         EquipmentIds[i] = avatarDetails.Outfit[i].Id;
     }
 }
Esempio n. 28
0
        public IActionResult Delete(NColor color)
        {
            var result = _iColorService.DeleteColor(color);

            if (result.Success == true)
            {
                return(Ok(result));
            }

            return(BadRequest(result));
        }
Esempio n. 29
0
        /// <summary>
        /// Creates a table panel, which is the content of a group.
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="borderColor"></param>
        /// <returns></returns>
        private NTableFlowPanel CreateTablePanel(NXmlElement owner, NColor borderColor)
        {
            int maxRows;

            if (TryGetInt(owner, "maxRows", out maxRows) == false)
            {
                maxRows = defaultMaxRows;
            }

            // Create a table flow panel for the items
            NTableFlowPanel table = new NTableFlowPanel();

            table.UniformWidths     = ENUniformSize.Max;
            table.UniformHeights    = ENUniformSize.Max;
            table.ColFillMode       = ENStackFillMode.Equal;
            table.Direction         = ENHVDirection.TopToBottom;
            table.HorizontalSpacing = ItemHorizontalSpacing;
            table.VerticalSpacing   = ItemVerticalSpacing;
            table.MaxOrdinal        = maxRows;

            // Create the items and add them to the table panel
            string categoryNamespace = GetNamespace(owner);

            int childCount = owner.ChildrenCount;

            for (int i = 0; i < childCount; i++)
            {
                NXmlElement child = owner.GetChildAt(i) as NXmlElement;
                if (child == null)
                {
                    continue;
                }

                switch (child.Name)
                {
                case "tile":
                    table.Add(CreateTile(child, categoryNamespace));
                    break;

                case "group":
                    table.Add(CreateGroup(child, borderColor));
                    break;

                case "label":
                    table.Add(CreateLabel(child));
                    break;

                default:
                    throw new Exception("New examples XML tag?");
                }
            }

            return(table);
        }
Esempio n. 30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="gauge"></param>
        private void InitSections(NGauge gauge)
        {
            gauge.Axes.Clear();
            NGaugeAxis axis = new NGaugeAxis();

            gauge.Axes.Add(axis);

            axis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top);

            NStandardScale scale = (NStandardScale)axis.Scale;

            // init text style for regular labels
            scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.White);
            scale.Labels.Style.TextStyle.Font = new NFont("Arimo", 10, ENFontStyle.Bold);

            // init ticks
            scale.MajorGridLines.Visible = true;
            scale.MinTickDistance        = 25;
            scale.MinorTickCount         = 1;
            scale.SetPredefinedScale(ENPredefinedScaleStyle.Scientific);

            // create sections
            NScaleSection blueSection = new NScaleSection();

            blueSection.Range           = new NRange(0, 20);
            blueSection.RangeFill       = new NColorFill(NColor.FromColor(NColor.Blue, 0.5f));
            blueSection.MajorGridStroke = new NStroke(NColor.Blue);
            blueSection.MajorTickStroke = new NStroke(NColor.DarkBlue);
            blueSection.MinorTickStroke = new NStroke(1, NColor.Blue, ENDashStyle.Dot);

            NTextStyle labelStyle = new NTextStyle();

            labelStyle.Fill            = new NColorFill(NColor.Blue);
            labelStyle.Font            = new NFont("Arimo", 10, ENFontStyle.Bold);
            blueSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(blueSection);

            NScaleSection redSection = new NScaleSection();

            redSection.Range = new NRange(80, 100);

            redSection.RangeFill       = new NColorFill(NColor.FromColor(NColor.Red, 0.5f));
            redSection.MajorGridStroke = new NStroke(NColor.Red);
            redSection.MajorTickStroke = new NStroke(NColor.DarkRed);
            redSection.MinorTickStroke = new NStroke(1, NColor.Red, ENDashStyle.Dot);

            labelStyle                = new NTextStyle();
            labelStyle.Fill           = new NColorFill(NColor.Red);
            labelStyle.Font           = new NFont("Arimo", 10.0, ENFontStyle.Bold);
            redSection.LabelTextStyle = labelStyle;

            scale.Sections.Add(redSection);
        }