Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public FrmMain(string userName, string password)
- {
- InitializeComponent();
- HomeLoadOfflineHelper.HomeLoadOffline(userName, password);
- txbUserName = userName;
- ph = new PageHome(userName, password);
- pm = new PageMonitoring();
- pa = new PageAboutus();
- DataContext = this;
- }
- public PageMonitoring()
- {
- InitializeComponent();
- InitializeNetworkInterface();
- Task.Run(() =>
- {
- short Counter = 0;
- LessPingSeries = new ChartValues<ObservableValue> { };
- NormalPingSeries = new ChartValues<ObservableValue> { };
- DownloadSeries = new ChartValues<ObservableValue> { };
- UploadSeries = new ChartValues<ObservableValue> { };
- while (true)
- {
- Thread.Sleep(2000);
- MessageBox.Show("OK");
- using (Ping ping = new Ping())
- {
- LessPingSeries.Add(new ObservableValue(ping.Send("8.8.8.8").RoundtripTime));
- NormalPingSeries.Add(new ObservableValue(ping.Send("4.2.2.4").RoundtripTime));
- }
- DownloadSeries.Add(new ObservableValue(ByteSize.FromBytes(bytesReceivedSpeed).MegaBytes));
- UploadSeries.Add(new ObservableValue(ByteSize.FromBytes(bytesSentSpeed).MegaBytes));
- Counter++;
- if (Counter >= 5)
- {
- LessPingSeries.RemoveAt(0);
- NormalPingSeries.RemoveAt(0);
- DownloadSeries.RemoveAt(0);
- UploadSeries.RemoveAt(0);
- Counter--;
- }
- Application.Current.Dispatcher.Invoke(() =>
- {
- UpdateNetworkInterface();
- });
- }
- });
- DataContext = this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement