예제 #1
0
파일: Form1.cs 프로젝트: playlinsor/Pinger
        // Пинг окончен.
        private void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            PingInformation pi = e.Result as PingInformation;

            TimerMaxDelay.Enabled = false;
            if (pi != null)
            {
                try
                {
                    if (pi.checkError())
                    {
                        Error = true;
                    }
                    TrayIcon.BalloonTipTitle = Text;
                    TrayIcon.BalloonTipText  = Lang.GetString("TXT_TRAY_MESSAGE", URL, pi.Delay);
                    PrintLogPingText(pi);
                    VisibleIconFromDelay(pi.Delay);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(Lang.GetString("TXT_MAIN_ERROR_TITLE"), Lang.GetString("TXT_MAIN_ERROR_MESSAGE", ex.Message), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            SleepWorker.RunWorkerAsync();
        }
예제 #2
0
파일: Form1.cs 프로젝트: playlinsor/Pinger
        // Logging information
        private void PrintLogPingText(PingInformation pi)
        {
            string Line = textBox2.Text;

            if (Line.Length > 4024)
            {
                Line = "";
            }

            if (!pi.checkError())
            {
                Line += Lang.GetString("TXT_FORM_LOG_MESSAGE", pi.IP, pi.Delay, pi.TTL);
            }
            else
            {
                Line += pi.getError();
            }

            textBox2.Text           = Line + "\r\n";
            textBox2.SelectionStart = textBox2.Text.Length;
            textBox2.ScrollToCaret();
        }