Interaction logic for MainWindow.xaml
Наследование: System.Windows.Window
Пример #1
0
 //Clears output window and statistics
 public void ClearOutputWindow(MainWindow window)
 {
     window.Output.Text = string.Empty; //Clears output window
 }
Пример #2
0
        public void PingHost(MainWindow window, int pingValue)
        {
            try
            {
                _temporaryPingDataFile = Path.GetTempFileName();
                _window = window;
                _pingCountValue = pingValue;
                _pingRoundTripSum = 0;
                _window.avgPingTime.Content = null;
                _window.numberOfPings.Content = null;
                //Checks to see if IPHostnameValue is in a valid IP or Hostname format, and then starts timedEvent
                if (Uri.CheckHostName(MainWindow.ipHostnameValue) != UriHostNameType.Unknown)
                {
                    _window.StartPing.IsEnabled = false;
                    _timer1.Start();
                    //Sets the focus to the output window, so it will scroll with the results
                    _window.Output.Focus();
                }
                else
                {
                    MessageBox.Show("Please enter a valid hostname or IP");
                }
            }
            catch(Exception er)
            {
                stopPing();
                MessageBox.Show("Error with application" + Environment.NewLine + Environment.NewLine + er);

            }
        }