Exemple #1
0
        public MainForm()
        {
            mainDriver = new Driver();
            InitializeComponent();
            Driver.Log             += Driver_Log;
            JoystickHelper.Log     += Driver_Log;
            SystemHelper.Log       += Driver_Log;
            Configuration.Log      += Driver_Log;
            Configuration.StopProc += btnStop_Click;
            this.FormClosing       += MainForm_FormClosing;
            this.FormClosed        += MainForm_FormClosed;

            Configuration.PropogateSettings();
            JoystickHelper.DestroyAll();
            //quietly finish the constructor if we're updating.
            SystemHelper.checkForMissingDrivers();
            if (disablePortsOnExit)
            {
            }
            if (startInTray)
            {
                this.Hide();
            }
            else
            {
                this.Show();
            }
            if (autoStart)
            {
                btnStart_Click(null, EventArgs.Empty);
            }
        }
        public MainForm()
        {
            mainDriver             = new Driver();
            updater                = new AutoUpdater.AutoUpdater();
            updater.currentVersion = version;
            InitializeComponent();
            Driver.Log             += Driver_Log;
            JoystickHelper.Log     += Driver_Log;
            SystemHelper.Log       += Driver_Log;
            Configuration.Log      += Driver_Log;
            Configuration.StopProc += btnStop_Click;
            this.FormClosing       += MainForm_FormClosing;
            this.FormClosed        += MainForm_FormClosed;

            Configuration.PropogateSettings();
            bool updating = false;

            if (autoUpdate && MainForm.updater.updateAvailable)
            {
                Update u = new Update();
                if (u.ShowDialog() == System.Windows.Forms.DialogResult.Yes)
                {
                    updating = true;
                }
            }
            //quietly finish the constructor if we're updating.
            if (!updating)
            {
                SystemHelper.checkForMissingDrivers();
                if (disablePortsOnExit)
                {
                    SystemHelper.EnablevJoyDLL();
                }
                if (startInTray)
                {
                    this.Hide();
                }
                else
                {
                    this.Show();
                }
                if (autoStart)
                {
                    btnStart_Click(null, EventArgs.Empty);
                }
            }
        }