/// <summary> /// Zkontroluje údaje a pokusí se připojit na server. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnPripojit_Click(object sender, EventArgs e) { if (TxtPrezdivka.Text.Length != 0 && TxtPrezdivka.Text.Length <= 30 && !string.IsNullOrWhiteSpace(TxtPrezdivka.Text)) { try { AdresaServeru = IPAddress.Parse(TxtIP.Text); Prezdivka = TxtPrezdivka.Text; if (ChckUlozitNast.Checked) { UlozeniNastaveni(); } var okno = new OknoKlienta(); Hide(); okno.ShowDialog(); Show(); } catch { MessageBox.Show("Adresa IP nebo portu byla špatně napsána!", "Chyba!"); TxtIP.Focus(); TxtIP.SelectAll(); } } else { MessageBox.Show("Přezdívka se musí skládat ze znaků a nesmí být delší než 30 znaků!", "Chyba!"); TxtPrezdivka.Focus(); TxtPrezdivka.SelectAll(); } }
private void RbtIPManual_CheckedChanged(object sender, EventArgs e) { if (RbtIPManual.Checked) { TxtIP.Clear(); TxtIP.Enabled = true; } }
/// <summary> /// Zjednodušení zadávání údajů. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TxtPrezdivka_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { TxtIP.Focus(); TxtIP.SelectAll(); } }
private void TxtIP_Leave(object sender, EventArgs e) { if (TxtIP.Text != "") { int ocurrenciasPunto = TxtIP.Text.Split('.').Length; if (!Funcion.ValidaIP(TxtIP.Text) || ocurrenciasPunto <= 3) { MessageBox.Show("Ingrese una Dirección IP Correca", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); TxtIP.Focus(); TxtIP.SelectAll(); } } }
private void RbtIPAutomatico_CheckedChanged(object sender, EventArgs e) { if (RbtIPAutomatico.Checked) { try { TxtIP.Clear(); TxtIP.Text = MeuIP.IPv4().ToString().Trim(); TxtIP.Enabled = false; } catch (Exception) { TxtIP.Enabled = true; RbtIPAutomatico.Enabled = false; RbtIPManual.Checked = true; } } }
void ReleaseDesignerOutlets() { if (TxtIP != null) { TxtIP.Dispose(); TxtIP = null; } if (LblHelp != null) { LblHelp.Dispose(); LblHelp = null; } if (CboAction != null) { CboAction.Dispose(); CboAction = null; } if (TxtNotes != null) { TxtNotes.Dispose(); TxtNotes = null; } if (CmdOk != null) { CmdOk.Dispose(); CmdOk = null; } if (CmdCancel != null) { CmdCancel.Dispose(); CmdCancel = null; } }