public override void Bind(IEditorService service) { _edSvc = service; _edSvc.RegisterCustomNotifier(this); _sym = (ISimpleSymbolDefinition)_edSvc.GetEditedResource(); _rbox = _sym.ResizeBox; try { _init = true; chkEnableResizeBox.Checked = (_rbox != null); grpResizeBox.Enabled = chkEnableResizeBox.Checked; if (_rbox == null) { _rbox = _sym.CreateResizeBox(); } symGrowControl.Items = SymbolField.GetItems <GrowControl>(); symGrowControl.Bind(_rbox, nameof(_rbox.GrowControl)); symHeight.Bind(_rbox, nameof(_rbox.SizeY)); symWidth.Bind(_rbox, nameof(_rbox.SizeX)); symXCoord.Bind(_rbox, nameof(_rbox.PositionX)); symYCoord.Bind(_rbox, nameof(_rbox.PositionY)); } finally { _init = false; } }
public static void ShowParameterSelector(IEnumerable<IParameter> symParameters, SymbolField sender) { var list = new List<string>(); if (sender.SupportedEnhancedDataTypes != null && sender.SupportedEnhancedDataTypes.Length > 0) { foreach (var dt in sender.SupportedEnhancedDataTypes) { list.Add(dt.ToString()); } } var diag = new ParameterSelector(symParameters, list); if (diag.ShowDialog() == DialogResult.OK) { sender.Content = "%" + diag.SelectedParameter.Name + "%"; } }
private void OnRequestBrowse(SymbolField sender) => ParameterSelector.ShowParameterSelector(_sym.ParameterDefinition.Parameter, sender);
public static void ShowParameterSelector(IEnumerable <IParameter> symParameters, SymbolField sender) { var list = new List <string>(); if (sender.SupportedEnhancedDataTypes != null && sender.SupportedEnhancedDataTypes.Length > 0) { foreach (var dt in sender.SupportedEnhancedDataTypes) { list.Add(dt.ToString()); } } var diag = new ParameterSelector(symParameters, list); if (diag.ShowDialog() == DialogResult.OK) { sender.Content = "%" + diag.SelectedParameter.Name + "%"; } }
/// <summary> /// Sets the initial state of this editor and sets up any databinding /// within such that user interface changes will propagate back to the /// model. /// </summary> /// <param name="service"></param> public override void Bind(IEditorService service) { service.RegisterCustomNotifier(this); _sym = (ISimpleSymbolDefinition)service.GetEditedResource(); _edSvc = service; _pu = _sym.PointUsage; _lu = _sym.LineUsage; _au = _sym.AreaUsage; try { _init = true; chkPoint.Checked = (_pu != null); chkLine.Checked = (_lu != null); chkArea.Checked = (_au != null); //Dunno why the event handler is not triggering at this point grpPoint.Enabled = chkPoint.Checked; grpLine.Enabled = chkLine.Checked; grpArea.Enabled = chkArea.Checked; if (_pu == null) { _pu = _sym.CreatePointUsage(); } if (_lu == null) { _lu = _sym.CreateLineUsage(); } if (_au == null) { _au = _sym.CreateAreaUsage(); } //Fill the lists fields symAreaAngleControl.Items = SymbolField.GetItems <AngleControl>(); symAreaClippingControl.Items = SymbolField.GetItems <ClippingControl>(); symAreaOriginControl.Items = SymbolField.GetItems <OriginControl>(); symLineAngleControl.Items = SymbolField.GetItems <AngleControl>(); symLineUnitsControl.Items = SymbolField.GetItems <UnitsControl>(); symLineVertexControl.Items = SymbolField.GetItems <VertexControl>(); symLineVertexJoin.Items = SymbolField.GetItems <VertexJoin>(); symPointAngleControl.Items = SymbolField.GetItems <AngleControl>(); symAreaAngle.Bind(_au, nameof(_au.Angle)); symAreaAngleControl.Bind(_au, nameof(_au.AngleControl)); symAreaBufferWidth.Bind(_au, nameof(_au.BufferWidth)); symAreaClippingControl.Bind(_au, nameof(_au.ClippingControl)); symAreaOriginControl.Bind(_au, nameof(_au.OriginControl)); symAreaOriginX.Bind(_au, nameof(_au.OriginX)); symAreaOriginY.Bind(_au, nameof(_au.OriginY)); symAreaRepeatX.Bind(_au, nameof(_au.RepeatX)); symAreaRepeatY.Bind(_au, nameof(_au.RepeatY)); symLineAngle.Bind(_lu, nameof(_lu.Angle)); symLineAngleControl.Bind(_lu, nameof(_lu.AngleControl)); symLineEndOffset.Bind(_lu, nameof(_lu.EndOffset)); symLineRepeat.Bind(_lu, nameof(_lu.Repeat)); symLineStartOffset.Bind(_lu, nameof(_lu.StartOffset)); symLineUnitsControl.Bind(_lu, nameof(_lu.UnitsControl)); symLineVertexAngleLimit.Bind(_lu, nameof(_lu.VertexAngleLimit)); symLineVertexControl.Bind(_lu, nameof(_lu.VertexControl)); symLineVertexJoin.Bind(_lu, nameof(_lu.VertexJoin)); symLineVertexMiterLimit.Bind(_lu, nameof(_lu.VertexMiterLimit)); symPointAngle.Bind(_pu, nameof(_pu.Angle)); symPointAngleControl.Bind(_pu, nameof(_pu.AngleControl)); symPointOriginOffsetX.Bind(_pu, nameof(_pu.OriginOffsetX)); symPointOriginOffsetY.Bind(_pu, nameof(_pu.OriginOffsetY)); } finally { _init = false; } }
private void OnRequestBrowse(SymbolField sender) { ParameterSelector.ShowParameterSelector(_sym.ParameterDefinition.Parameter, sender); }