private void markerComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!updateLocked && markerComboBox.SelectedItem is MarkerType)
     {
         evts.OnMarkerChanged((MarkerType)markerComboBox.SelectedItem);
     }
 }
Esempio n. 2
0
        void IConfigDialogView.UpdateNodePropertiesControls(NodeProperties props)
        {
            nodeDescriptionTextView.Value = props?.Description ?? "";

            if (colorPopup.Menu.Count == 0 && props != null)
            {
                foreach (var c in props.Palette)
                {
                    colorPopup.Menu.AddItem(colorItems[c.Argb] = CreateGraphicsMenuItem((g, r) =>
                    {
                        using (var b = new Brush(c.ToColor()))
                            g.FillRectangle(b, r);
                    }, () => evts.OnColorChanged(c)));
                }
            }
            if (markerPopup.Menu.Count == 0 && props != null)
            {
                foreach (var m in Enum.GetValues(typeof(MarkerType)))
                {
                    markerPopup.Menu.AddItem(markerItems[(MarkerType)m] = CreateGraphicsMenuItem((g, r) =>
                    {
                        Drawing.DrawLegendSample(g, resources,
                                                 new ModelColor(0xff, 0, 0, 0), (MarkerType)m, r);
                    }, () => evts.OnMarkerChanged((MarkerType)m)));
                }
            }

            if ((colorPopup.Enabled = (props != null && props.Color != null)) == true)
            {
                colorPopup.SelectItem(colorItems[props.Color.Value.Argb]);
            }
            else
            {
                colorPopup.SelectItem((NSMenuItem)null);
            }
            if ((markerPopup.Enabled = (props != null && props.Marker != null)) == true)
            {
                markerPopup.SelectItem(markerItems[props.Marker.Value]);
            }
            else
            {
                markerPopup.SelectItem((NSMenuItem)null);
            }

            if ((drawLineCheckbox.Enabled = (props != null && props.DrawLine != null)) == true)
            {
                drawLineCheckbox.State = props.DrawLine.Value ? NSCellStateValue.On : NSCellStateValue.Off;
            }
            else
            {
                drawLineCheckbox.State = NSCellStateValue.On;
            }
        }