當前位置: 首頁>>代碼示例>>C#>>正文


C# Visual3D.FireOnVisualParentChanged方法代碼示例

本文整理匯總了C#中System.Windows.Media.Media3D.Visual3D.FireOnVisualParentChanged方法的典型用法代碼示例。如果您正苦於以下問題:C# Visual3D.FireOnVisualParentChanged方法的具體用法?C# Visual3D.FireOnVisualParentChanged怎麽用?C# Visual3D.FireOnVisualParentChanged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Media.Media3D.Visual3D的用法示例。


在下文中一共展示了Visual3D.FireOnVisualParentChanged方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RemoveVisual3DChild

        /// <summary>
        /// DisconnectChild
        ///
        ///    Derived classes must call this method to notify the Visual3D layer that a
        ///    child was removed from the children collection. The Visual3D layer will then call
        ///    GetVisual3DChild to find out which child has been removed.
        ///
        /// </summary>
        protected void RemoveVisual3DChild(Visual3D child)
        {
            // It is invalid to modify the children collection that we 
            // might be iterating during a property invalidation tree walk.
            if (IsVisualChildrenIterationInProgress)
            {
                throw new InvalidOperationException(SR.Get(SRID.CannotModifyVisualChildrenDuringTreeWalk));
            }

            Debug.Assert(child != null);
            Debug.Assert(child.InternalVisualParent == this);

            child.SetParent(/* newParent = */ (Visual3D) null);  // CS0121: Call is ambigious without casting null to Visual3D.
                    
            // remove the inheritance context
            RemoveSelfAsInheritanceContext(child, null);
                        
            //
            // Remove the child on all the channels 
            // this visual is being marshalled to.
            //

            for (int i = 0, limit = _proxy.Count; i < limit; i++) 
            {
                DUCE.Channel channel = _proxy.GetChannel(i);

                if (child.CheckFlagsAnd(channel, VisualProxyFlags.IsConnectedToParent))
                {
                    child.SetFlags(channel, false, VisualProxyFlags.IsConnectedToParent);
                    DUCE.IResource childResource = (DUCE.IResource)child;
                    childResource.RemoveChildFromParent(this, channel);
                    childResource.ReleaseOnChannel(channel);
                }
            }

            //
            // Force a full precompute and render pass for this visual.
            //

            Visual3D.PropagateFlags(
                this, 
                VisualFlags.IsSubtreeDirtyForPrecompute,
                VisualProxyFlags.IsSubtreeDirtyForRender);

            // 


            // Fire notifications
            child.FireOnVisualParentChanged(this);

            OnVisualChildrenChanged(/* visualAdded = */ null , child);
        }
開發者ID:JianwenSun,項目名稱:cc,代碼行數:60,代碼來源:Visual3D.cs

示例2: AddVisual3DChild

        //------------------------------------------------------
        //
        //  Public Properties
        //
        //------------------------------------------------------
        
        //------------------------------------------------------
        //
        //  Public Events
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Protected Methods
        //
        //------------------------------------------------------
        
        #region Protected Methods

        /// <summary>
        /// AttachChild
        ///
        ///    Derived classes must call this method to notify the Visual3D layer that a new
        ///    child appeard in the children collection. The Visual3D layer will then call the GetVisual3DChild
        ///    method to find out where the child was added.
        ///
        ///  Remark: To move a Visual3D child in a collection it must be first disconnected and then connected
        ///    again. (Moving forward we might want to add a special optimization there so that we do not
        ///    unmarshal our composition resources).
        /// </summary>
        protected void AddVisual3DChild(Visual3D child)
        {            
            // It is invalid to modify the children collection that we 
            // might be iterating during a property invalidation tree walk.
            if (IsVisualChildrenIterationInProgress)
            {
                throw new InvalidOperationException(SR.Get(SRID.CannotModifyVisualChildrenDuringTreeWalk));
            }

            Debug.Assert(child != null);
            Debug.Assert(child.InternalVisualParent == null);

            child.SetParent(this);
            
            // set the inheritance context so databinding, etc... work
            ProvideSelfAsInheritanceContext(child, null);
            
            // The child already might be dirty. Hence we need to propagate dirty information
            // from the parent and from the child.
            Visual3D.PropagateFlags(
                this, 
                VisualFlags.IsSubtreeDirtyForPrecompute, 
                VisualProxyFlags.IsSubtreeDirtyForRender);

            Visual3D.PropagateFlags(
                child, 
                VisualFlags.IsSubtreeDirtyForPrecompute, 
                VisualProxyFlags.IsSubtreeDirtyForRender);

            // 


            // Fire notifications
            OnVisualChildrenChanged(child, /* visualRemoved = */ null);
            
            child.FireOnVisualParentChanged(null);
        }
開發者ID:JianwenSun,項目名稱:cc,代碼行數:68,代碼來源:Visual3D.cs


注:本文中的System.Windows.Media.Media3D.Visual3D.FireOnVisualParentChanged方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。