private void buttonConnect_Click(object sender, EventArgs e) { //set session switch (_selectedModem) { case Device.BBOX3S: _session = new Bbox3Session(backgroundWorkerGetLineData, _profiles); break; case Device.BBOX2: _session = new Bbox2Session(); break; case Device.FritzBox7390: _session = new FritzBoxSession(); break; case Device.BBOX3T: _session = null; break; default: _session = null; break; } if (_session == null) { MessageBox.Show("Please select a device.", "Connection failure", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //set button text buttonConnect.Text = "Connecting, please wait..."; buttonConnect.Enabled = false; //check mode bool debug = (textBoxUsername.Text.ToLower() == "debug"); if (debug) { InitDebugMode(); } else { InitNormalMode(); } }
private void InitDebugMode() { //get textbox values string host = textBoxIpAddress.Text; string username = "******"; //overwrite textbox value string password = textBoxPassword.Text; //init session _session = new Bbox3Session(backgroundWorkerGetLineData, _profiles, true); if (_session.OpenSession(host, username, password)) { buttonConnect.Enabled = false; panelDebug.Visible = true; panelInfo.Visible = false; panelLogin.Visible = false; } else { //set button text buttonConnect.Text = "Connect"; buttonConnect.Enabled = true; MessageBox.Show("Could not connect to device.", "Connection failure", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void initDebugMode() { //get textbox values string host = textBoxIpAddress.Text; string username = "******"; //overwrite textbox value string password = textBoxPassword.Text; //init session _session = new Bbox3Session(backgroundWorkerGetLineData, _profiles, true); if (_session.OpenSession(host, username, password)) { buttonConnect.Enabled = false; panelDebug.Visible = true; panelInfo.Visible = false; panelLogin.Visible = false; } else { //set button text buttonConnect.Text = "Connect"; buttonConnect.Enabled = true; MessageBox.Show("Could not connect to device.", "Connection failure", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonConnect_Click(object sender, EventArgs e) { //set session switch (_selectedModem) { case Device.BBOX3S: _session = new Bbox3Session(backgroundWorkerGetLineData, _profiles); break; case Device.BBOX2: _session = new Bbox2Session(); break; case Device.FritzBox7390: _session = new FritzBoxSession(); break; case Device.BBOX3T: _session = null; break; case Device.unknown: default: _session = null; break; } if (_session == null) { MessageBox.Show("Please select a device.", "Connection failure", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //set button text buttonConnect.Text = "Connecting, please wait..."; buttonConnect.Enabled = false; //check mode bool debug = (textBoxUsername.Text.ToLower() == "debug"); if (debug) initDebugMode(); else initNormalMode(); }