Beispiel #1
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected override void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    if (_logo != null)
                    {
                        _logo.Dispose();
                    }

                    if (_2D != null)
                    {
                        _2D.Dispose();
                    }
                }
            }

            _container = null;
            _2D        = null;
            _logo      = null;
            _disposed  = true;

            base.Dispose(disposing);
        }
Beispiel #2
0
        /// <summary>
        /// Function to perform initialization on the content.
        /// </summary>
        /// <returns>A control to embed into the container interface.</returns>
        protected override ContentPanel OnInitialize()
        {
            _delta = Program.Settings.AnimateStartPageLogo ? Program.Settings.StartPageAnimationPulseRate.Abs() : 0;

            _container = new ContentPanel(this)
            {
                CaptionVisible = false
            };

            _2D = Graphics.Output.Create2DRenderer(_container.PanelDisplay);

            // Create the logo for display.
            _logo = Graphics.Textures.FromMemory <GorgonTexture2D>("Logo", Resources.Gorgon_2_x_Logo_Blurry, new GorgonCodecDDS());

            var textureCoordinates = new RectangleF(Vector2.Zero, _logo.ToTexel(new Vector2(_logo.Settings.Width, _logo.Settings.Height / 3)));

            // Set up coordinates for our blurred images.
            _blurStates = new[]
            {
                textureCoordinates,                                                                    // No blur.
                new RectangleF(new Vector2(0, textureCoordinates.Height), textureCoordinates.Size),    // Medium blur.
                new RectangleF(new Vector2(0, textureCoordinates.Height * 2), textureCoordinates.Size) // Max blur.
            };

            _sourceState = _blurStates[2];
            _destState   = _blurStates[1];

            return(_container);
        }
Beispiel #3
0
        /// <summary>
        /// Function to load the content and its related UI.
        /// </summary>
        /// <param name="contentObject">Content to load.</param>
        /// <param name="isDefault">TRUE if this is the default content, FALSE if not.</param>
        private static void LoadContent(ContentObject contentObject, bool isDefault)
        {
            // Unload any content that's currently active.
            UnloadCurrentContent();

            // Initialize content resources.
            ContentPanel contentWindow = contentObject.InitializeContent();

            _currentContentObject = contentObject;

            // Do not count the default content pane as being "content".
            // This "Current" content being null will be our indicator that no content is currently active.
            if (!isDefault)
            {
                Current = contentObject;
            }

            if (contentWindow == null)
            {
                return;
            }

            if (ContentInitializedAction != null)
            {
                contentWindow.Dock = DockStyle.Fill;
                ContentInitializedAction(contentWindow);
            }

            if (ContentEnumerateProperties != null)
            {
                // Enumerate properties for the content.
                ContentEnumerateProperties(contentObject.HasProperties);
            }

            // Force focus to the content window.
            if (contentWindow.Parent != null)
            {
                contentWindow.Focus();
            }

            if (contentObject.HasRenderer)
            {
                Gorgon.ApplicationIdleLoopMethod = IdleLoop;
            }
        }