示例#1
0
 /// <summary>
 /// Remove a specific emit protocol.  Non-existent emitted protocols are ignored.
 /// </summary>
 protected virtual void RemoveEmitProtocol(string protocolName)
 {
     if (emitProtocols.Exists(p => p.Protocol == protocolName))
     {
         emitProtocols.Remove(emitProtocols.Single(p => p.Protocol == protocolName));
         EmitProtocolsChanged.Fire(this, EventArgs.Empty);
     }
 }
示例#2
0
        /// <summary>
        /// Add protocol that this receptor emits.
        /// </summary>
        protected virtual void AddEmitProtocol(string p, bool processInternalSemanticElements = true)
        {
            if (!emitProtocols.Contains(p))
            {
                emitProtocols.Add(p);
                EmitProtocolsChanged.Fire(this, EventArgs.Empty);

                // Kludge to allow a receptor to specify that internal semantic elements of a protocol
                // should not be processed.  ThumbnailCreatorReceptor and ThumbnailViewerReceptor are
                // good use cases for this, as otherwise an infinite loop will occur between the two,
                // as the creator also would emit the SE "ImageFilename" and the viewer emits "ImageFilename"
                // as part of the SE's ViewImage and GetImageMetadata
                if (processInternalSemanticElements)
                {
                    AddInternalSemanticElements(p);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Add the protocol that this receptor emits.  Duplicates are ignored.
        /// </summary>
        protected virtual void AddEmitProtocol(string protocolName, bool processInternalSemanticElements = true)
        {
            // We can encounter the same protocol when we recurse into the internal semantics, so ignore repeats.
            if (!emitProtocols.Exists(p => p.Protocol == protocolName))
            {
                bool cachedEnableState;
                cachedEmitProtocolConfig.TryGetValue(protocolName, out cachedEnableState).Else(() => cachedEnableState = true);
                emitProtocols.Add(new EmittedProtocol()
                {
                    Protocol = protocolName, Enabled = cachedEnableState
                });
                EmitProtocolsChanged.Fire(this, EventArgs.Empty);

                // Kludge to allow a receptor to specify that internal semantic elements of a protocol
                // should not be processed.  ThumbnailCreatorReceptor and ThumbnailViewerReceptor are
                // good use cases for this, as otherwise an infinite loop will occur between the two,
                // as the creator also would emit the SE "ImageFilename" and the viewer emits "ImageFilename"
                // as part of the SE's ViewImage and GetImageMetadata
                if (processInternalSemanticElements)
                {
                    AddInternalSemanticElements(protocolName);
                }
            }
        }
示例#4
0
 /// <summary>
 /// Remove all emit protocols.
 /// </summary>
 protected virtual void RemoveEmitProtocols()
 {
     emitProtocols.Clear();
     EmitProtocolsChanged.Fire(this, EventArgs.Empty);
 }
示例#5
0
 /// <summary>
 /// Remove a specific emit protocol.
 /// </summary>
 protected virtual void RemoveEmitProtocol(string p)
 {
     emitProtocols.Remove(p);
     EmitProtocolsChanged.Fire(this, EventArgs.Empty);
 }