From 227602483d574f410f6f5c3002928d7ba989bec6 Mon Sep 17 00:00:00 2001 From: Alexander Eckart Date: Thu, 22 Mar 2012 09:50:02 +0100 Subject: [PATCH] some additional try-catches for graphic inits --- Vocaluxe/Base/CDraw.cs | 27 +++++++++++++++++++++++++-- Vocaluxe/Lib/Draw/CDirect3D.cs | 12 +++++++++--- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs index 7c13e322..2ea8879a 100644 --- a/Vocaluxe/Base/CDraw.cs +++ b/Vocaluxe/Base/CDraw.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.Text; +using System.Windows.Forms; using Vocaluxe.Base; using Vocaluxe.Lib.Draw; @@ -21,11 +22,33 @@ namespace Vocaluxe.Base case ERenderer.TR_CONFIG_SOFTWARE: _Draw = new CDrawWinForm(); break; + case ERenderer.TR_CONFIG_OPENGL: - _Draw = new COpenGL(); + try + { + _Draw = new COpenGL(); + } + catch (Exception e) + { + MessageBox.Show(e.Message + " - Error in initializing of OpenGL", + CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); + CLog.LogError(e.Message + " - Error in initializing of OpenGL"); + Environment.Exit(Environment.ExitCode); + } break; + case ERenderer.TR_CONFIG_DIRECT3D: - _Draw = new CDirect3D(); + try + { + _Draw = new CDirect3D(); + } + catch (Exception e) + { + MessageBox.Show("No DirectX runtimes were found, please download and install them from http://www.microsoft.com/download/en/details.aspx?id=8109", + CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); + CLog.LogError(e.Message + " - No DirectX runtimes were found, please download and install them from http://www.microsoft.com/download/en/details.aspx?id=8109"); + Environment.Exit(Environment.ExitCode); + } break; default: diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 224f8a2f..63f4f770 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -77,7 +77,9 @@ namespace Vocaluxe.Lib.Draw } catch (Direct3D9NotFoundException e) { - MessageBox.Show("No DirectX runtimes were found, please download and install them from http://www.microsoft.com/download/en/details.aspx?id=8109"); + MessageBox.Show("No DirectX runtimes were found, please download and install them " + + "from http://www.microsoft.com/download/en/details.aspx?id=8109", + CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); CLog.LogError(e.Message + " - No DirectX runtimes were found, please download and install them from http://www.microsoft.com/download/en/details.aspx?id=8109"); Environment.Exit(Environment.ExitCode); } @@ -181,7 +183,9 @@ namespace Vocaluxe.Lib.Draw } catch (Exception e) { - MessageBox.Show("Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109", "Vocaluxe", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show("Something went wrong during device creating, please check if your DirectX redistributables " + + "and graphic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109", + CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); CLog.LogError(e.Message + " - Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109"); Environment.Exit(Environment.ExitCode); } @@ -189,7 +193,9 @@ namespace Vocaluxe.Lib.Draw { if (_Device == null || _Device.Disposed) { - MessageBox.Show("Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109", "Vocaluxe", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show("Something went wrong during device creating, please check if your DirectX redistributables " + + "and graphic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109", + CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); CLog.LogError("Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109"); Environment.Exit(Environment.ExitCode); }