コード例 #1
0
ファイル: Form1.cs プロジェクト: jaenudin86/MikroTik
        // Slanje mail-a
        public void sendMailToOffice()
        {
            NetworkTool pingGoogle = new NetworkTool();
            int         counter    = 10;
            string      message;

            while (counter != 0)
            {
                string temp = pingGoogle.getPing("8.8.8.8");
                switch (temp)
                {
                case "ping ok":
                    mail.setMailSender(textMailAddress.Text, textPartnerPassword.Text);
                    message = mail.sendMail();
                    switch (temp)
                    {
                    case "OK":
                        writeToConsole(message);
                        break;

                    default:
                        writeToConsole(message);
                        break;
                    }

                    counter = 1;
                    break;

                case "no ping":
                    if (counter == 1)
                    {
                        writeToConsole("Mail nije poslat.");
                        writeToConsole("Problem sa internet konekcijom.");
                    }
                    break;

                default:
                    if (counter == 1)
                    {
                        writeToConsole("Mail nije poslat. Problem sa internet konekcijom.");
                    }
                    break;
                }
                Thread.Sleep(1500);
                counter--;
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Hispanion/MikroTik
        // Slanje mail-a
        public void sendMailToOffice()
        {
            NetworkTool pingGoogle = new NetworkTool();
            int counter = 10;
            string message;
            while (counter != 0)
            {
                string temp = pingGoogle.getPing("8.8.8.8");
                switch (temp)
                {
                    case "ping ok":
                        mail.setMailSender(textMailAddress.Text, textPartnerPassword.Text);
                        message = mail.sendMail();
                        switch (temp)
                        {
                            case "OK":
                            writeToConsole(message);
                            break;
                            default:
                            writeToConsole(message);
                            break;
                        }

                        counter = 1;
                        break;
                    case "no ping":
                        if (counter == 1)
                        {
                            writeToConsole("Mail nije poslat.");
                            writeToConsole("Problem sa internet konekcijom.");
                        }
                        break;
                    default:
                        if (counter == 1)
                            writeToConsole("Mail nije poslat. Problem sa internet konekcijom.");
                        break;

                }
                Thread.Sleep(1500);
                counter--;
            }
        }