Пример #1
0
        protected void CreateError(CIContainer aContainer, CIElement aAssociatedElement, string aTitle, string aDescription)
        {
            CIMessageError message = new CIMessageError(aContainer, aTitle);

            message.Description = aDescription;
            //
            aAssociatedElement.AddChild(message);
        }
Пример #2
0
        protected void CreateMessage(CIContainer aContainer, CIElement aAssociatedElement, string aTitle, string aDescription)
        {
            CIMessage message = CIMessage.NewMessage(aContainer);

            message.Title       = aTitle;
            message.Description = aDescription;
            //
            aAssociatedElement.AddChild(message);
        }
Пример #3
0
        internal CISymbol RefreshRegistration(CIElement aElement, uint aSymbolAddress, CISymbol aOldSymbolOrNull)
        {
            CISymbol ret            = aOldSymbolOrNull;
            bool     needToRegister = false;

            if (aOldSymbolOrNull != null)
            {
                // We only need to do this if the symbol address changed.
                if (aSymbolAddress != aOldSymbolOrNull.Address)
                {
                    // We must unregister the symbol from the parent element because potentially we might
                    // replace the symbol with an entirely new one.
                    aElement.RemoveChild(aOldSymbolOrNull);

                    // However, we only do this if there are no other client of the same symbol.
                    int newRefCount = aOldSymbolOrNull.ReferenceCountDecrement();
                    if (newRefCount <= 0)
                    {
                        // Remove old references to dead symbol
                        DoDeregister(aOldSymbolOrNull);
                    }

                    // Since the address of the symbol has changed, we will need to
                    // re-register a new symbol
                    needToRegister = true;
                }
                else
                {
                    // The symbol address hasn't changed
                }
            }
            else if (aSymbolAddress == 0 && aOldSymbolOrNull == null)
            {
                // Err, nothing to do here.
            }
            else
            {
                // We weren't supplied with an original symbol object which means we will
                // definitely need to register a symbol (if we don't find a pre-existing match).
                needToRegister = true;
            }

            // Do we need to register a new symbol?
            if (needToRegister)
            {
                // Create new entry (or look up existing reference). This will also
                // ensure any new symbol is registered with this dictionary.
                ret = Register(aSymbolAddress);

                // Associate with parent element
                aElement.AddChild(ret);
            }

            return(ret);
        }