Beispiel #1
0
        static void Main(string[] args)
        {
            //var fi = new FileInfo(Application.ExecutablePath);
            //Directory.SetCurrentDirectory(fi.Directory.FullName);

            // IMPORTANT: Make sure this class don't have any static references to x360ce.Engine library or
            // program tries to load x360ce.Engine.dll before AssemblyResolve event is available and fails.
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
            if (IsDebug)
            {
                StartApp(args);
                return;
            }
            try
            {
                StartApp(args);
            }
            catch (Exception ex)
            {
                var message = AppHelper.ExceptionToText(ex);
                var box     = new Controls.MessageBoxForm();
                if (message.Contains("Could not load file or assembly 'Microsoft.DirectX"))
                {
                    message += "===============================================================\r\n";
                    message += "You can click the link below to download Microsoft DirectX.";
                    box.MainLinkLabel.Text    = "http://www.microsoft.com/en-us/download/details.aspx?id=35";
                    box.MainLinkLabel.Visible = true;
                }
                var result = box.ShowForm(message, "Exception!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                if (result == DialogResult.Cancel)
                {
                    Application.Exit();
                }
            }
        }
Beispiel #2
0
 static void Main(string[] args)
 {
     if (IsDebug)
     {
         StartApp(args);
         return;
     }
     try
     {
         StartApp(args);
     }
     catch (Exception ex)
     {
         var message = AppHelper.ExceptionToText(ex);
         var box     = new Controls.MessageBoxForm();
         if (message.Contains("Could not load file or assembly 'Microsoft.DirectX"))
         {
             message += "===============================================================\r\n";
             message += "You can click the link below to download Microsoft DirectX.";
             box.MainLinkLabel.Text    = "http://www.microsoft.com/en-us/download/details.aspx?id=35";
             box.MainLinkLabel.Visible = true;
         }
         var result = box.ShowForm(message, "Exception!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
         if (result == DialogResult.Cancel)
         {
             Application.Exit();
         }
     }
 }