Interaction logic for MainWindow.xaml
Inheritance: System.Windows.Window
コード例 #1
0
ファイル: helper.cs プロジェクト: ingram1987/tping-gui
 //Clears output window and statistics
 public void ClearOutputWindow(MainWindow window)
 {
     window.Output.Text = string.Empty; //Clears output window
 }
コード例 #2
0
ファイル: helper.cs プロジェクト: ingram1987/tping-gui
        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);

            }
        }