static void Main() { try { Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); CommunicationManager cm = new CommunicationManager(); CellularProtocol cp = new CellularProtocol(cm); SwitchProtocol sp = new SwitchProtocol(cp); frmCommLog commLog = frmCommLog.Instance; commLog.commManager = cm; Application.Run(new mainForm(sp, cm)); } catch (Exception e) { FormTools.ErrBox(e.Message, "Error"); } }
public mainForm(SwitchProtocol sp, CommunicationManager cm) { InitializeComponent(); sp_ = sp; cm_ = cm; string[] ports = CommunicationManager.GetComPortNames(); if (ports.Length > 0) { foreach (string str in ports) { cmbComPort.Items.Add(str); } } else cmbComPort.Items.Add("NO COM PORT!"); cmbComPort.SelectedIndex = 0; SetCommunicationValues(); removeUser.Enabled = false; statusProgressBar.Visible = false; cmbSwitchPhone.Items.Add(Properties.Settings.Default.SwitchPhone); cmbSwitchPhone.SelectedIndex = 0; btnConnectTtransmitter.Focus(); }