public void AddNetworkFailsWhenAddingDuplicatedTarget() { NetworkCollection manager = CreateNetworkManager(); manager.UpdateStatus(); manager.Add(new Network("TestNetwork", "http://test1")); manager.Add(new Network("TestNetwork", "http://test2")); }
private void DisplayNetworkReport(WiFiNetworkReport report) { NetworkCollection.Clear(); foreach (var network in report.AvailableNetworks) { NetworkCollection.Add(new WiFiNetworkDisplay(network, _firstAdapter)); } }
public override async Task OnSearch(object value = null) { await _model.SearchNetworkAsync(); Application.Current.Dispatcher.Invoke(new Action(() => { NetworkCollection.Clear(); foreach (NetworkInterfaces net in _model.NetworkCollection) { NetworkCollection.Add(net); } })); }
private void NetworkMonitoring() { while (true) { List <NetworkAdapter> adapters = networkMoniter.Refresh(); Application.Current.Dispatcher.BeginInvoke(new Action(() => { long uploadSpeed = 0; long downloadSpeed = 0; int i = 0; for (; i < adapters.Count; i += 1) { uploadSpeed += adapters[i].UploadSpeed; downloadSpeed += adapters[i].downloadSpeed; if (NetworkCollection.Count <= i) { NetworkCollection.Add(new NetworkModelView(adapters[i])); } else { NetworkCollection[i].Resolve(adapters[i]); } } while (NetworkCollection.Count > i) { NetworkCollection.RemoveAt(i); } speedQueue.Enqueue(uploadSpeed + downloadSpeed); while (speedQueue.Count > 200) { speedQueue.Dequeue(); } GlobalUploadSpeed = NetworkAdapter.GetSpeedString(uploadSpeed); GlobalDownloadSpeed = NetworkAdapter.GetSpeedString(downloadSpeed); Notify(() => GlobalUploadSpeed); Notify(() => GlobalDownloadSpeed); Notify(() => GraphPointCollection); })); Thread.Sleep(1000); } }
private async Task <bool> UpdateNetworkInfo() { DeviceName = DeviceInfoPresenter.GetDeviceName(); IPAddress = NetworkPresenter.GetCurrentIpv4Address(); NetworkName = NetworkPresenter.GetCurrentNetworkName(); AppBuild = Common.GetAppVersion(); AzureHub = IoTHubService?.HostName ?? Common.GetLocalizedText("NotAvailable"); AzureDeviceId = IoTHubService?.DeviceId ?? Common.GetLocalizedText("NotAvailable"); var networkInfoList = await NetworkPresenter.GetNetworkInformation(); if (networkInfoList != null) { NetworkCollection.Clear(); foreach (var network in networkInfoList) { NetworkCollection.Add(new NetworkInfoDataTemplate(network)); } return(true); } return(false); }