Example #1
0
        /// <summary>
        /// Gets the parameters.
        /// </summary>
        /// <param name="csym">The csym.</param>
        /// <returns></returns>
        public static IEnumerable <IParameter> GetParameters(this ICompoundSymbolDefinition csym)
        {
            Check.NotNull(csym, "csym");
            Check.NotNull(csym.CurrentConnection, "csym.CurrentConnection");
            List <IParameter> p = new List <IParameter>();

            foreach (var sym in csym.SimpleSymbol)
            {
                if (sym.Type == SimpleSymbolReferenceType.Inline)
                {
                    ISimpleSymbolInlineReference ssir = (ISimpleSymbolInlineReference)sym;
                    p.AddRange(ssir.SimpleSymbolDefinition.GetParameters());
                }
                else if (sym.Type == SimpleSymbolReferenceType.Library)
                {
                    ISimpleSymbolLibraryReference sslr = (ISimpleSymbolLibraryReference)sym;
                    var symDef = (ISymbolDefinitionBase)csym.CurrentConnection.ResourceService.GetResource(sslr.ResourceId);
                    if (symDef.Type == SymbolDefinitionType.Simple)
                    {
                        p.AddRange(((ISimpleSymbolDefinition)symDef).GetParameters());
                    }
                    else
                    {
                        p.AddRange(((ICompoundSymbolDefinition)symDef).GetParameters());
                    }
                }
            }
            return(p);
        }
        /// <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);
            _edSvc = service;
            _compSym = (ICompoundSymbolDefinition)_edSvc.GetEditedResource();
            _compSym.PurgeSimpleSymbolAttributes();

            TextBoxBinder.BindText(txtName, _compSym, "Name");
            TextBoxBinder.BindText(txtDescription, _compSym, "Description");

            foreach (var symRef in _compSym.SimpleSymbol)
            {
                AddSymbolReference(symRef);
            }
        }
Example #3
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);
            _edSvc   = service;
            _compSym = (ICompoundSymbolDefinition)_edSvc.GetEditedResource();
            _compSym.PurgeSimpleSymbolAttributes();

            TextBoxBinder.BindText(txtName, _compSym, "Name");
            TextBoxBinder.BindText(txtDescription, _compSym, "Description");

            foreach (var symRef in _compSym.SimpleSymbol)
            {
                AddSymbolReference(symRef);
            }
        }