Ejemplo n.º 1
0
        private void CloseCurrentApp()
        {
            richTextBox1.Text = Resources.MainWindow_CloseCurrentApp_Loading___;

            if (_currentApp != null)
            {
                _currentApp.DeInit();
            }

            // Clean up
            _currentApp = null;

            if (_currentControl != null)
            {
                _currentControl.HandleCreated -= renderControl_HandleCreated;
                _currentControl.Dispose();
                splitContainer1.Panel2.Controls.Remove(_currentControl);
                _currentControl = null;
            }

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

            // Just in case...
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
Ejemplo n.º 2
0
        private void StartCurrentApp()
        {
            Width  = (int)(Screen.PrimaryScreen.WorkingArea.Width * 0.8f);
            Height = (int)(Screen.PrimaryScreen.WorkingArea.Height * 0.8f);

            Left = Screen.PrimaryScreen.Bounds.Width / 2 - Width / 2;
            Top  = Screen.PrimaryScreen.Bounds.Height / 2 - Height / 2;

            splitContainer1.Panel2.Update();

            //
            //  STEP ONE - Create the Winforms Control
            //
            _currentControl = new RenderControl
            {
                BackColor = Color.Black,
                Location  = new System.Drawing.Point(0, 0),
                Size      = splitContainer1.Panel2.Size,
                Dock      = DockStyle.Fill,
                Name      = "RenderControl",
                TabIndex  = 0
            };

            _currentControl.HandleCreated += renderControl_HandleCreated; // <- This is crucial: Prepare for STEP TWO.

            splitContainer1.Panel2.Controls.Add(_currentControl);
        }
        private void CloseCurrentApp()
        {
            richTextBox1.Text = "";

            // Clean up
            _currentApp = null;

            if (_currentControl != null)
            {
                _currentControl.HandleCreated -= renderControl_HandleCreated;
                splitContainer1.Panel2.Controls.Remove(_currentControl);
                _currentControl.Dispose();
                _currentControl = null;
            }
            if (_currentHost != null)
            {
                _currentHost.Dispose();
                _currentHost = null;
            }

            // Just in case...
            GC.Collect();
            GC.WaitForFullGCComplete();
        }
        private void StartCurrentApp()
        {
            Width = 1440;
            Height = 602;

            //
            //  STEP ONE - Create the Winforms Control
            //
            _currentControl = new RenderControl
            {
                BackColor = Color.Black,
                Location = new System.Drawing.Point(0, 0),
                Size = splitContainer1.Panel2.Size,
                Dock = DockStyle.Fill,
                Name = "RenderControl",
                TabIndex = 0
            };

            _currentControl.HandleCreated += renderControl_HandleCreated; // <- This is crucial: Prepare for STEP TWO.

            splitContainer1.Panel2.Controls.Add(_currentControl);
        }