//---------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright (C)2007 DarkWynter Studios. All rights reserved.
//
//---------------------------------------------------------------------------------------------------------------------------------------------------
// {Contact : darkwynter.com for licensing information
//---------------------------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
//using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.CodeDom.Compiler;
using System.CodeDom;
using System.IO;
//using System.Xml;
using Microsoft.Win32;
//using Microsoft.Xna;
//using Microsoft.Xna.Framework;
using DarkWynter.Engine.Globals;
using DarkWynter.Engine.Utilities;
using DarkWynter.Engine.GameObjects;
using System.Threading;
namespace DarkWynter.Shell
{
///
/// GameForm controls the game entry point as well as the compiler entry
/// points for the Game2Learn system
///
public partial class GameForm : Form
{
/// Initializes a new DarkWynter host form
public GameForm()
{
// Check library support for engine.
CheckSupport();
// Create UCAD control
InitializeComponent();
this.WindowState = FormWindowState.Maximized;
this.MinimizeBox = false;
this.MaximizeBox = false;
this.ControlBox = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
// Connect UCAD's pointers to GameForm and create new childform.
ucad1.UCAD_ParentForm = this;
ucad1.UCAD_ChildForm = new Form();
ucad1.UCAD_ChildForm.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
ucad1.UCAD_ChildForm.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ucad1.UCAD_ChildForm.ClientSize = new System.Drawing.Size(800, 400);
// Auto load default controls into UCAD
ucad1.Load_UCAD_File("UCAD_CompilerLibrary.xml");
DarkWynter.Engine.DarkWynterEngine._userSettingsFile = "_xml\\UserSettings\\UserSettings.xml";
// Get the Form name from UCAD
this.Text = UCAD._UCAD_FormName;
}
private void CheckSupport()
{
Installer installer = new Installer();
installer.Controls.Clear();
installer.Controls.Add(installer.labelInstall);
installer.Controls.Add(installer.labelDirections);
installer.Hide();
// Check .Net 2.0 Support
RegistryKey RK = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v2.0.50727");
if (RK == null)
{
installer.Controls.Add(installer.buttonDownloadDotNet);
installer.Show();
this.Controls.Clear();
this.Controls.Add(installer);
}
// Check DirectX Support
RK = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\DirectX");
if (RK == null)
{
installer.Controls.Add(installer.buttonDownloadDirectX);
installer.Show();
this.Controls.Clear();
this.Controls.Add(installer);
}
// Check XNA Support
RK = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\XNA\\Framework\\v2.0");
if (RK == null)
{
installer.Controls.Add(installer.buttonDownloadXNA);
installer.Show();
this.Controls.Clear();
this.Controls.Add(installer);
}
}
#region Quit, Enter, Load (Mostly Not Used)
///
/// Executed when the user clicks the quit button
///
/// Quit button that has been clicked
/// Not used
private void quitClicked(object sender, FormClosingEventArgs e)
{
//string name = Logging.CreateFileName();
//Logging.writeG2LLog(name);
//Logging.writeG2LSurvey(name);
//Logging.writeG2LPositionalLog(name);
Application.Exit();
}
# endregion
}
}