Exemplo n.º 1
0
        /// <summary>
        /// Reload the display and its content.  Reloading will also delete any other resources we have.
        /// </summary>
        /// <param name="bHard">True if we want to remove and then re-create the webcontrol.  False if we just want to do a web-refresh.</param>
        /// <param name="bIgnoreCache">If this is just a web-refresh, do we want to ignore the cache.</param>
        public void Reload(bool bHard, bool bIgnoreCache = true)
        {
            // If it is active.
            if (ActiveControl == null)
            {
                return;
            }

            // If it is on a surface.
            if (ActiveSurface == null)
            {
                return;
            }

            // If it is a hard reset.
            if (bHard)
            {
                // Remove the control and re-add it.
                ActiveSurface.Display_SetVisual(null);
                ActiveControl.Dispose();
                ActiveControl = null;

                this.DeleteResources();
                ActiveControl = CreateRenderable();
                ActiveSurface.Display_SetVisual(ActiveControl);
            }
            else
            {
                this.DeleteResources();
                ActiveControl.Reload(bIgnoreCache);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called by the authority to signal that this surface has been deleted.
        /// </summary>
        internal void Authority_Delete()
        {
            // If we are still attached to a surface, throw an error.
            if (ActiveSurface != null)
            {
                throw new Exception("Cannot delete display while still attached to surface.");
            }

            // Remove the web control.
            if (ActiveControl != null)
            {
                ActiveControl.Dispose();
                ActiveControl = null;
            }

            // Free up any other resources we may have created.
            this.DeleteResources();

            // And'were done - set the deleted flag.
            bDeleted = true;

            // Say we are deleted.
            if (OnDeleted != null)
            {
                OnDeleted(this);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Called by a surface to signal that this display should detach from it.
        /// </summary>
        /// <remarks>Here it could destroy the visual to be shown and remove it from the surface by calling: pSurface.Display_SetVisual(null).</remarks>
        /// <param name="pSurface"></param>
        public void Surface_UnbindFromSurface(Surface pSurface)
        {
            // Error checking.
            if (pSurface == null)
            {
                throw new ArgumentNullException("Cannot unbind from a null surface.");
            }

            // Check the surface is our active one.
            if (pSurface != ActiveSurface)
            {
                throw new Exception("Surface to deatch from and stored surface do not match.");
            }

            // Unbind from spatial update events.
            ActiveSurface.OnSurfacePropertiesUpdated -= Surface_OnSpatialPropertiesUpdated;

            // Remove the renderable from the surface.
            ActiveSurface.Display_SetVisual(null);
            ActiveSurface.Display_ResetVisualRenderSize();

            // Destroy the renderable.
            //  n.b. With a few small changes (i.e. not calling this) we could preserve the WebView while not attached to a surface.
            //       this would be good for moving displays without losing state.
            ActiveControl.Dispose();
            ActiveControl = null;

            // Remove any resources we have attached (i.e. spatial queries).
            this.DeleteResources();

            // Remove the reference to the active surface.
            ActiveSurface = null;
        }