Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private async Task<bool> CheckEnable()
- {
- var allInterfaces = await Sockets.Plugin.CommsInterface.GetAllInterfacesAsync();
- var enableInterfaces = allInterfaces.Where(ci => ci.IsUsable && !ci.IsLoopback && (ci.ConnectionStatus == Sockets.Plugin.Abstractions.CommsInterfaceStatus.Connected || ci.ConnectionStatus == Sockets.Plugin.Abstractions.CommsInterfaceStatus.Unknown));
- this.Interfaces.Clear();
- foreach (var item in enableInterfaces)
- {
- this.Interfaces.Add(new TNetworkInterface() { Name = (item.Name == "{ unknown }" ? item.IpAddress : item.Name), IpAddress = item.IpAddress });
- }
- var isEnable = (this.Interfaces.Count() > 0);
- if (isEnable)
- {
- this.SelectedInterface = this.Interfaces[0];
- }
- return isEnable;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement