private void OpenGui(object sender, EventArgs e) { if (_mainForm == null) { _mainForm = new frmMain2(); _mainForm.MQTT = MQTT; _mainForm.Disposed += MainForm_Disposed; _mainForm.Shown += _mainForm_Shown; // start checking for subscription updates from the FDA //dataReceivedCheckTimer.Change(dataReceivedCheckRate, Timeout.Infinite); _mainForm.Show(); _mainForm.SetFDAStatus(Status); //_mainForm.SetVersion(_FDAVersion); //_mainForm.SetDBType(_FDADBType); //_mainForm.SetRunTime(_FDARuntime); //if (bg_MQTTConnect != null) //{ // _mainForm.SetConnectionMenuItems(!bg_MQTTConnect.IsBusy); //} } else { _mainForm.Focus(); } }
private void MainForm_Disposed(object sender, EventArgs e) { _mainForm.Disposed -= MainForm_Disposed; _mainForm = null; //dataReceivedCheckTimer.Change(Timeout.Infinite, Timeout.Infinite); }