private void PortNameCB_SelectedIndexChanged(object sender, EventArgs e) { if (BaudRatePanel.Enabled) { this.BaudRateCB.Items.Clear(); BaudRateCB.DropDownStyle = ComboBoxStyle.DropDownList; //User can't change values when connection is open. if (Target.IsOpen) { BaudRateCB.Items.Add(Target.BaudRate); this.BaudRateCB.SelectedItem = 0; } else { foreach (int it in GXSMS.GetAvailableBaudRates(PortNameCB.Text)) { if (it == 0) { BaudRateCB.DropDownStyle = ComboBoxStyle.DropDown; } else { this.BaudRateCB.Items.Add(it); } } this.BaudRateCB.SelectedItem = Target.BaudRate; } } }
private void TestBtn_Click(object sender, EventArgs e) { try { GXSMS sms = new GXSMS(); sms.PortName = this.PortNameCB.Text; sms.BaudRate = Convert.ToInt32(this.BaudRateCB.Text); sms.DataBits = Convert.ToInt32(this.DataBitsCB.Text); sms.Parity = (System.IO.Ports.Parity) this.ParityCB.SelectedItem; sms.StopBits = (System.IO.Ports.StopBits) this.StopBitsCB.SelectedItem; if (sms.Test(this)) { MessageBox.Show(this, "Modem found."); } else { MessageBox.Show(this, "Modem not found."); } this.Activate(); } catch (Exception ex) { MessageBox.Show(this, ex.Message); } }
/// <summary> /// Constructor. /// </summary> public Settings(GXSMS target) { InitializeComponent(); Target = target; }
private void TestBtn_Click(object sender, EventArgs e) { try { GXSMS sms = new GXSMS(); sms.PortName = this.PortNameCB.Text; sms.BaudRate = Convert.ToInt32(this.BaudRateCB.Text); sms.DataBits = Convert.ToInt32(this.DataBitsCB.Text); sms.Parity = (System.IO.Ports.Parity)this.ParityCB.SelectedItem; sms.StopBits = (System.IO.Ports.StopBits)this.StopBitsCB.SelectedItem; if (sms.Test(this)) { MessageBox.Show(this, "Modem found."); } else { MessageBox.Show(this, "Modem not found."); } this.Activate(); } catch (Exception ex) { MessageBox.Show(this, ex.Message); } }
/// <summary> /// Constructor. /// </summary> public Settings(GXSMS target) { InitializeComponent(); Target = target; }
void IGXPropertyPage.Initialize() { //Update texts. this.Text = Gurux.SMS.Properties.Resources.SettingsTxt; this.PinLbl.Text = Gurux.SMS.Properties.Resources.PINCodeTxt; this.PortNameLbl.Text = Gurux.SMS.Properties.Resources.PortNameTxt; this.BaudRateLbl.Text = Gurux.SMS.Properties.Resources.BaudRateTxt; this.DataBitsLbl.Text = Gurux.SMS.Properties.Resources.DataBitsTxt; this.ParityLbl.Text = Gurux.SMS.Properties.Resources.ParityTxt; this.StopBitsLbl.Text = Gurux.SMS.Properties.Resources.StopBitsTxt; this.IntervalLbl.Text = Gurux.SMS.Properties.Resources.SMSCheckIntervalTxt; this.PinTB.Text = Target.PIN; this.IntervalTX.Text = Target.SMSCheckInterval.ToString(); this.NumberTB.Text = Target.PhoneNumber; NumberPanel.Enabled = (Target.ConfigurableSettings & AvailableMediaSettings.PhoneNumber) != 0; PinPanel.Enabled = (Target.ConfigurableSettings & AvailableMediaSettings.SIM) != 0; //Hide controls which user do not want to show. PortNamePanel.Enabled = (Target.ConfigurableSettings & AvailableMediaSettings.PortName) != 0; if (PortNamePanel.Enabled) { if (Target.AvailablePorts != null) { PortNameCB.Items.AddRange(Target.AvailablePorts); } else { PortNameCB.Items.AddRange(GXSMS.GetPortNames()); } if (this.PortNameCB.Items.Contains(Target.PortName)) { this.PortNameCB.SelectedItem = Target.PortName; } else { this.PortNameCB.SelectedIndex = 0; } } BaudRatePanel.Enabled = (Target.ConfigurableSettings & AvailableMediaSettings.BaudRate) != 0; if (BaudRatePanel.Enabled) { PortNameCB_SelectedIndexChanged(null, null); this.BaudRateCB.SelectedItem = Target.BaudRate; } DataBitsPanel.Enabled = (Target.ConfigurableSettings & AvailableMediaSettings.DataBits) != 0; if (DataBitsPanel.Enabled) { this.DataBitsCB.Items.Add(7); this.DataBitsCB.Items.Add(8); this.DataBitsCB.SelectedItem = Target.DataBits; } ParityPanel.Enabled = (Target.ConfigurableSettings & AvailableMediaSettings.Parity) != 0; if (ParityPanel.Enabled) { this.ParityCB.Items.Add(System.IO.Ports.Parity.None); this.ParityCB.Items.Add(System.IO.Ports.Parity.Odd); this.ParityCB.Items.Add(System.IO.Ports.Parity.Even); this.ParityCB.Items.Add(System.IO.Ports.Parity.Mark); this.ParityCB.Items.Add(System.IO.Ports.Parity.Space); this.ParityCB.SelectedItem = Target.Parity; } StopBitsPanel.Enabled = (Target.ConfigurableSettings & AvailableMediaSettings.StopBits) != 0; if (StopBitsPanel.Enabled) { this.StopBitsCB.Items.Add(System.IO.Ports.StopBits.None); this.StopBitsCB.Items.Add(System.IO.Ports.StopBits.One); this.StopBitsCB.Items.Add(System.IO.Ports.StopBits.OnePointFive); this.StopBitsCB.Items.Add(System.IO.Ports.StopBits.Two); this.StopBitsCB.SelectedItem = Target.StopBits; } }
public SMSReceiveThread(GXSMS parent) { Closing = new ManualResetEvent(false); m_Parent = parent; }
public SMSReceiveThread(GXSMS parent) { Closing = new ManualResetEvent(false); m_Parent = parent; }