using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VR2;

namespace VR2Test
{
    public partial class Form1 : Form
    {
        VR2Main vr2;

        public Form1()
        {
            InitializeComponent();
            btnStart.Enabled = true;
            btnStop.Enabled = false;
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            vr2 = new VR2Main();
            vr2.Start(Application.StartupPath + "\\VR2Config.xml");
            btnStart.Enabled = false;
            btnStop.Enabled = true;
        }

        private void btnStop_Click(object sender, EventArgs e)
        {
            vr2.Stop();
            vr2 = null;
            btnStart.Enabled = true;
            btnStop.Enabled = false;
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (vr2 != null)
            {
                vr2.Stop();
                vr2 = null;
            }
        }
    }
}