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); } }
public void OpenLog() { // Get the login details using (LogonForm lf = new LogonForm()) { DialogResult dr = lf.ShowDialog(); if (dr != DialogResult.OK) return; ContactStore = new ContactStore(lf.Server, lf.Database, lf.Username, lf.Password); if (ContactStoreChanged != null) ContactStoreChanged(this, new EventArgs()); if (!string.IsNullOrEmpty(lf.CivSerialPort) && lf.RadioModel.HasValue) { Radio = new RadioFactory().GetRadio(lf.RadioModel.Value, new RadioConnectionSettings { BaudRate = lf.CivSpeed, FlowControl = FlowControl.None, Port = lf.CivSerialPort, UseDTR = lf.CivDtr, UseRTS = lf.CivRts}); if (Radio is IWinKey) CWMacro.WinKey = (IWinKey)Radio; if (CivServerChanged != null) CivServerChanged(this, new EventArgs()); } } }