I am trying to make a winform open an Xna form. looking online the best way I discovered was to open the form first through program.cs, and then put an if statement that checks if you hit the start button on the winform that will give DialogResult.OK . I know I need to start the form using ShowDialog, but I get two forms with my current code. it opens one, I close it, it opens another winform and when you close that, you get the Xna form. Any suggestions? here is my code:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
using(Form1 form = new Form1())
{
form.ShowDialog();
if(form.ShowDialog() == DialogResult.OK)
{
using (Game1 game = new Game1())
{
game.Run();
}
}
}
}
}
here is my button code:
private void button1_Click(object sender, EventArgs e)
{
compotents comps = new compotents();
comps.mass = textBox1.Text;
comps.velocity = textBox2.Text;
comps.gravity = textBox3.Text;
button1.DialogResult = DialogResult.OK;
this.Close();
}
(compotents is a class i am using to store variables and use them in the xna form)