Ejemplo n.º 1
0
        /// <summary>
        /// Show the window in the current application, starting a new application if required.
        /// </summary>
        public void Show()
        {
            // Ignore request if already shown
            if (_isShown)
            {
                return;
            }

            // Ensure application is running and if not start it although we are not resposible for the main loop
            if (App.CurrentApplication == null)
            {
                new App();
            }
            App app = App.CurrentApplication;

            if (!app.IsStarted)
            {
                app.Startup();
            }

            // Create our surface and shell surfaces accordingly - we trust App is initialised correctly
            Registry registry = app.Registry;

            _surface = registry.Compositor.CreateShellSurface(registry.SharedMemory, registry.Shell);
            _surface.RenderTarget = this;
            _surface.StartRenderingEvents();

            // Mark as initialised
            _isShown = true;
        }