Beispiel #1
0
        /// <summary>
        ///     Defines or removes a mapping in the output map.
        /// </summary>
        /// <param name="inputControl">
        ///     a PhysicalControlInfo object
        ///     representing the source of data (input)
        /// </param>
        /// <param name="outputControl">
        ///     a VirtualControlInfo object representing the target
        ///     (output) for data coming from the specified physical control
        /// </param>
        /// <returns>
        ///     a boolean indicating if the output map has changed as a result
        ///     of this operation. Allows editors to call this method without
        ///     being aware of all of the current mappings, and yet still be able to
        ///     detect whether changes have occurred as a result of an attempted
        ///     modification of the map.
        /// </returns>
        public bool SetMapping(PhysicalControlInfo inputControl, VirtualControlInfo outputControl)
        {
            VirtualControlInfo currentMapping = null;

            if (_mappings.ContainsKey(inputControl))
            {
                currentMapping = _mappings[inputControl];
                _mappings.Remove(inputControl);
            }
            _mappings.Add(inputControl, outputControl);
            if (currentMapping != null)
            {
                if (outputControl == null)
                {
                    return(true);
                }
                return(!currentMapping.Equals(outputControl));
            }
            if (outputControl == null)
            {
                return(false);
            }
            return(true);
        }
Beispiel #2
0
 /// <summary>
 ///     Checks whether the output map contains a mapping to a specific virtual data source
 /// </summary>
 /// <param name="virtualControl">a VirtualControlInfo object representing a virtual data source to check</param>
 /// <returns>
 ///     true, if the output map contains any mappings to the specified virtual data source, or false if the output map
 ///     does not contain any mappings to the specified virtual data source
 /// </returns>
 public bool ContainsMappingTo(VirtualControlInfo virtualControl)
 {
     return(_mappings.ContainsValue(virtualControl));
 }