/// <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;
            }
        }
Beispiel #2
0
        /// <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, "Angle");
                symAreaAngleControl.Bind(_au, "AngleControl");
                symAreaBufferWidth.Bind(_au, "BufferWidth");
                symAreaClippingControl.Bind(_au, "ClippingControl");
                symAreaOriginControl.Bind(_au, "OriginControl");
                symAreaOriginX.Bind(_au, "OriginX");
                symAreaOriginY.Bind(_au, "OriginY");
                symAreaRepeatX.Bind(_au, "RepeatX");
                symAreaRepeatY.Bind(_au, "RepeatY");

                symLineAngle.Bind(_lu, "Angle");
                symLineAngleControl.Bind(_lu, "AngleControl");
                symLineEndOffset.Bind(_lu, "EndOffset");
                symLineRepeat.Bind(_lu, "Repeat");
                symLineStartOffset.Bind(_lu, "StartOffset");
                symLineUnitsControl.Bind(_lu, "UnitsControl");
                symLineVertexAngleLimit.Bind(_lu, "VertexAngleLimit");
                symLineVertexControl.Bind(_lu, "VertexControl");
                symLineVertexJoin.Bind(_lu, "VertexJoin");
                symLineVertexMiterLimit.Bind(_lu, "VertexMiterLimit");

                symPointAngle.Bind(_pu, "Angle");
                symPointAngleControl.Bind(_pu, "AngleControl");
                symPointOriginOffsetX.Bind(_pu, "OriginOffsetX");
                symPointOriginOffsetY.Bind(_pu, "OriginOffsetY");
            }
            finally
            {
                _init = false;
            }
        }