public async Task Run()
        {
            try
            {
                await Settings.Load();

                InitializeRenderForm();

                _graphics = new GraphicsD3D11();
                _graphics.Initialise(_dxForm, true);
                _dxForm.UserResized += (sender, args) =>
                {
                    var renderForm = sender as RenderForm;
                    ClientSize  = new Size(renderForm.ClientSize.Width, renderForm.ClientSize.Height);
                    UserResized = true;
                };
                _overlayForm.Show();
                RenderLoop.Run(_dxForm, RenderCallback, true);
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(string.Format("Exception running DirectX host window.\r\n{0}", ex.Message), "DirectX Host", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Exception running DirectX host window.\r\n{0}", ex.Message), "DirectX Host", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
 public DirectXHost()
 {
     try
     {
         InitializeRenderForm();
         _graphics = new GraphicsD3D11();
         _graphics.Initialise(_dxForm, true);
         _dxForm.UserResized += (sender, args) =>
         {
             var renderForm = sender as RenderForm;
             ClientSize  = new Size(renderForm.ClientSize.Width, renderForm.ClientSize.Height);
             UserResized = true;
         };
         LoadContent();
     }
     catch (Exception ex)
     {
         MessageBox.Show(string.Format("Exception loading DirectX host window.\r\n{0}", ex.Message), "DirectX Host", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }