/// <summary>
        /// Creates the application's Ultraviolet context.
        /// </summary>
        private void CreateUltravioletContext()
        {
            LoadSettings();

            uv = UltravioletContext.EnsureSuccessfulCreation(OnCreatingUltravioletContext);
            if (uv == null)
            {
                throw new InvalidOperationException(UltravioletStrings.ContextNotCreated);
            }

            if (this.settings != null)
            {
                this.settings.Apply(uv);
            }

            CreateUltravioletHostCore();

            this.uv.Messages.Subscribe(this, UltravioletMessages.Quit);
            this.uv.Updating      += uv_Updating;
            this.uv.Shutdown      += uv_Shutdown;
            this.uv.WindowDrawing += uv_WindowDrawing;
            this.uv.WindowDrawn   += uv_WindowDrawn;

            this.uv.GetPlatform().Windows.PrimaryWindowChanging += uv_PrimaryWindowChanging;
            this.uv.GetPlatform().Windows.PrimaryWindowChanged  += uv_PrimaryWindowChanged;
            HookPrimaryWindowEvents();

            this.created = true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the application's Ultraviolet context.
        /// </summary>
        private void CreateUltravioletContext()
        {
            LoadSettings();

            uv = UltravioletContext.EnsureSuccessfulCreation(OnCreatingUltravioletContext);
            if (uv == null)
            {
                throw new InvalidOperationException(UltravioletStrings.ContextNotCreated);
            }

            ApplySettings();

            CreateUltravioletHostCore();

            this.uv.Messages.Subscribe(this,
                                       UltravioletMessages.ApplicationTerminating,
                                       UltravioletMessages.ApplicationSuspending,
                                       UltravioletMessages.ApplicationSuspended,
                                       UltravioletMessages.ApplicationResuming,
                                       UltravioletMessages.ApplicationResumed,
                                       UltravioletMessages.LowMemory,
                                       UltravioletMessages.Quit);
            this.uv.Updating      += uv_Updating;
            this.uv.Shutdown      += uv_Shutdown;
            this.uv.WindowDrawing += uv_WindowDrawing;
            this.uv.WindowDrawn   += uv_WindowDrawn;

            this.uv.GetPlatform().Windows.PrimaryWindowChanging += uv_PrimaryWindowChanging;
            this.uv.GetPlatform().Windows.PrimaryWindowChanged  += uv_PrimaryWindowChanged;
            HookPrimaryWindowEvents();

            this.created = true;

            InitializeContext();
        }