Example #1
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            if (btnSend.Enabled == false)
            {
                return;
            }

            try
            {
                btnSend.Enabled = false;
                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient(edtSmtpServer.Text.Trim());

                mail.From = new MailAddress(edtVon.Text.Trim());
                mail.To.Add(edtTo.Text.Trim());
                mail.Subject = edtSubject.Text.Trim();
                mail.Body    = edtMailContent.Text.Trim();

                try
                {
                    SmtpServer.Port = Convert.ToInt32(edtSmtpPort.Text.Trim());
                }
                catch (Exception)
                {
                    MessageBox.Show("Smtp-Port darf nur Zahlen enthalten. Abbruch!");
                    btnSend.Enabled = true;
                    return;
                }

                SmtpServer.Credentials = new System.Net.NetworkCredential(edtSmtpUser.Text.Trim(), edtSmtpPw.Text.Trim());

                if (cbSSL.Checked)
                {
                    SmtpServer.EnableSsl = true;
                }
                else
                {
                    SmtpServer.EnableSsl = false;
                }

                SmtpServer.Send(mail);
                MessageBox.Show("Mail Gesendet!");
                btnSend.Enabled = true;
            }
            catch (Exception)
            {
                if (CheckNetworkConnection.start())
                {
                    MessageBox.Show("Fehler beim Senden der Daten. SMTP-Eingaben überprüfen. Abbruch!");
                }
                btnSend.Enabled = true;
            }
        }
Example #2
0
        private void btnSuche_Click(object sender, EventArgs e)
        {
            if (btnSuche.Enabled == false)
            {
                return;
            }

            btnSuche.Enabled = false;
            try
            {
                sbStart = getStationBoard(cbStart, lbBoardStart, tabStart);
                sbZiel  = getStationBoard(cbZiel, lbBoardZiel, tabZiel);
                if (rbTimeOFF.Checked)
                {
                    getStationConnection(cbStart.Text, cbZiel.Text);
                }
                else
                {
                    if (rbTimeStart.Checked)
                    {
                        getDateTimeConnection(cbStart.Text, cbZiel.Text, dtpArrivalDate.Text, dtpArrivalTime.Text, 0);
                    }
                    else
                    {
                        getDateTimeConnection(cbStart.Text, cbZiel.Text, dtpArrivalDate.Text, dtpArrivalTime.Text, 1);
                    }
                }

                if (lbBoardStart.Items.Count > 0 && lbVerbindungStart.Items.Count == 0 && lbBoardZiel.Items.Count == 0)
                {
                    pageControl.SelectedTab = tabStart;
                    pageControl.Focus();
                }
                else if (lbBoardStart.Items.Count == 0 && lbVerbindungStart.Items.Count == 0 && lbBoardZiel.Items.Count > 0)
                {
                    pageControl.SelectedTab = tabZiel;
                    pageControl.Focus();
                }
                else
                {
                    pageControl.SelectedTab = tabVerbindung;
                    pageControl.Focus();
                }
            }
            catch (Exception)
            {
                CheckNetworkConnection.start();
            }
            btnSuche.Enabled = true;
        }
Example #3
0
        private void autoComplete()
        {
            ComboBox activeControl;

            if (this.ActiveControl is ComboBox)
            {
                activeControl = (ComboBox)this.ActiveControl;
            }
            else
            {
                return;
            }

            string inputText = activeControl.Text;

            if (activeControl.Text.Length >= 3 && !(activeControl.Items.Contains(activeControl.Text)))
            {
                timerAutocomplete.Enabled = true;
                timerAutocomplete.Start();
                try
                {
                    validStations = getValidSations(activeControl.Text);
                    activeControl.Items.Clear();
                    if (validStations != null)
                    {
                        foreach (Station s in validStations.StationList)
                        {
                            activeControl.Items.Add(s.Name);
                        }
                    }
                    activeControl.DroppedDown    = true;
                    activeControl.Text           = inputText;
                    activeControl.SelectionStart = activeControl.Text.Length;
                }
                catch (Exception)
                {
                    timerAutocomplete.Stop();
                    timerAutocomplete.Enabled = false;
                    CheckNetworkConnection.start();
                }
            }
            dateAndTimeGUIControl();
        }
Example #4
0
 private void formMain_Load(object sender, EventArgs e)
 {
     CheckNetworkConnection.start();
 }