示例#1
0
        /// <summary>
        ///     Copies data into a cloned instance.
        /// </summary>
        /// <param name="original">
        ///     The original instance to copy data from.
        /// </param>
        /// <param name="useCurrentValue">
        ///     Whether or not to copy the current value of expressions, or the
        ///     expressions themselves.
        /// </param>
        /// <param name="willBeFrozen">
        ///     Indicates whether or not the clone will be frozen.  If the
        ///     clone will be immediately frozen, there is no need to clone
        ///     data that is already frozen, you can just share the instance.
        /// </param>
        /// <remarks>
        ///     Override this method if you have additional non-DP state that
        ///     should be transfered to clones.
        /// </remarks>
        protected override void CopyCore(CustomBitmap original, bool useCurrentValue, bool willBeFrozen)
        {
            ChainedBitmap originalChainedBitmap = (ChainedBitmap)original;

            if (originalChainedBitmap._formatConverter != null)
            {
                if (useCurrentValue)
                {
                    if (willBeFrozen)
                    {
                        _formatConverter = (FormatConvertedBitmap)originalChainedBitmap._formatConverter.GetCurrentValueAsFrozen();
                    }
                    else
                    {
                        _formatConverter = (FormatConvertedBitmap)originalChainedBitmap._formatConverter.CloneCurrentValue();
                    }
                }
                else
                {
                    if (willBeFrozen)
                    {
                        _formatConverter = (FormatConvertedBitmap)originalChainedBitmap._formatConverter.GetAsFrozen();
                    }
                    else
                    {
                        _formatConverter = (FormatConvertedBitmap)originalChainedBitmap._formatConverter.Clone();
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        ///     Copies data into a cloned instance.
        /// </summary>
        /// <param name="source">
        ///     The original instance to copy data from.
        /// </param>
        /// <remarks>
        ///     Freezable.GetAsFrozen is semantically equivalent to
        ///     Freezable.Clone().Freeze(), except that you can avoid copying
        ///     any portions of the Freezable graph which are already frozen.
        ///
        ///     If you derive from this class and have additional non-DP state
        ///     that should be transfered to copies, you should override the
        ///     CopyCommon method.
        /// </remarks>
        protected sealed override void GetAsFrozenCore(Freezable source)
        {
            base.GetAsFrozenCore(source);

            CustomBitmap customBitmapSource = (CustomBitmap)source;

            CopyCore(customBitmapSource, /*useCurrentValue*/ false, /*willBeFrozen*/ true);
        }
示例#3
0
 /// <summary>
 ///     Copies data into a cloned instance.
 /// </summary>
 /// <param name="original">
 ///     The original instance to copy data from.
 /// </param>
 /// <param name="useCurrentValue">
 ///     Whether or not to copy the current value of expressions, or the
 ///     expressions themselves.
 /// </param>
 /// <param name="willBeFrozen">
 ///     Indicates whether or not the clone will be frozen.  If the
 ///     clone will be immediately frozen, there is no need to clone
 ///     data that is already frozen, you can just share the instance.
 /// </param>
 /// <remarks>
 ///     Override this method if you have additional non-DP state that
 ///     should be transfered to clones.
 /// </remarks>
 protected virtual void CopyCore(CustomBitmap original, bool useCurrentValue, bool willBeFrozen)
 {
 }