private void MainForm_Shown(object sender, EventArgs e) { RadioFactory radioFactory = new RadioFactory(); RadioConnectionSettings rcs = new RadioConnectionSettings(); RadioModel model; string logbookUrl; using (ConnectionForm connForm = new ConnectionForm()) { DialogResult dr = connForm.ShowDialog(this); if (dr == System.Windows.Forms.DialogResult.OK) { model = connForm.Model; rcs.BaudRate = connForm.Speed; rcs.Port = connForm.SerialPort; rcs.UseDTR = connForm.UseDTR; rcs.UseRTS = connForm.UseRTS; logbookUrl = connForm.LogbookURL; } else { Close(); return; } } try { m_Radio = radioFactory.GetRadio(model, rcs); m_RadioLabel.Text = m_Radio.ToString(); m_API = new CloudlogAPI(logbookUrl); m_UpdateThread = new Thread(UpdateFrequency); m_UpdateThread.IsBackground = true; m_UpdateThread.Start(); m_HttpHost = new HttpServer.HttpHost(new System.Net.IPEndPoint(IPAddress.Any, int.Parse(Settings.Get("ServerPort", Settings.DEFAULT_PORT)))); m_HttpHost.Start(); RigStatusServer.Radio = m_Radio; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void MainForm_Shown(object sender, EventArgs e) { RadioFactory radioFactory = new RadioFactory(); RadioConnectionSettings rcs = new RadioConnectionSettings(); RadioModel model; string logbookUrl; using (ConnectionForm connForm = new ConnectionForm()) { DialogResult dr = connForm.ShowDialog(this); if (dr == System.Windows.Forms.DialogResult.OK) { model = connForm.Model; rcs.BaudRate = connForm.Speed; rcs.Port = connForm.SerialPort; rcs.UseDTR = connForm.UseDTR; rcs.UseRTS = connForm.UseRTS; logbookUrl = connForm.LogbookURL; } else { Close(); return; } } try { m_Radio = radioFactory.GetRadio(model, rcs); m_RadioLabel.Text = m_Radio.ToString(); m_API = new CloudlogAPI(logbookUrl); m_UpdateThread = new Thread(UpdateFrequency); m_UpdateThread.IsBackground = true; m_UpdateThread.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }