/// <summary> /// Attaches the element to the specified host. /// </summary> /// <param name="host">The host.</param> public virtual void Attach(IRenderHost host) { this.isAttached = true; this.device = host.Device; this.effect = host.Effects[effectName]; this.renderHost = host; }
/// <summary> /// Used to override Detach /// </summary> protected virtual void OnDetach() { IsAttached = false; renderTechnique = null; effect = null; renderHost = null; }
/// <summary> /// Attaches the element to the specified host. /// </summary> /// <param name="host">The host.</param> public virtual void Attach(IRenderHost host) { this.renderTechnique = this.renderTechnique == null ? host.RenderTechnique : this.renderTechnique; this.effect = EffectsManager.Instance.GetEffect(renderTechnique); this.renderHost = host; this.InvalidateRender(); }
/// <summary> /// Attaches the element to the specified host. /// </summary> /// <param name="host">The host.</param> public virtual void Attach(IRenderHost host) { renderTechnique = this.renderTechnique == null ? host.RenderTechnique : this.renderTechnique; renderHost = host; effect = renderHost.EffectsManager.GetEffect(renderTechnique); InvalidateRender(); }
/// <summary> /// <para>Attaches the element to the specified host. To overide Attach, please override <see cref="OnAttach(IRenderHost)"/> function.</para> /// <para>To set different render technique instead of using technique from host, override <see cref="SetRenderTechnique"/></para> /// <para>Attach Flow: <see cref="SetRenderTechnique(IRenderHost)"/> -> Set RenderHost -> Get Effect -> <see cref="OnAttach(IRenderHost)"/> -> <see cref="OnAttached"/> -> <see cref="InvalidateRender"/></para> /// </summary> /// <param name="host">The host.</param> public void Attach(IRenderHost host) { if (IsAttached || host == null) { return; } renderHost = host; if (host.EffectsManager == null) { throw new ArgumentException("EffectManger does not exist. Please make sure the proper EffectManager has been bind from view model."); } this.renderTechnique = SetRenderTechnique(host); effect = renderHost.EffectsManager.GetEffect(renderTechnique); IsAttached = OnAttach(host); if (IsAttached) { OnAttached(); } InvalidateRender(); }
/// <summary> /// Detaches the element from the host. /// </summary> public virtual void Detach() { this.renderTechnique = null; this.effect = null; this.renderHost = null; }
/// <summary> /// Detaches the element from the host. /// </summary> public virtual void Detach() { renderTechnique = null; effect = null; renderHost = null; }