示例#1
0
 private void ScanNics(ISettings settings)
 {
     NetworkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
     _hardware         = NetworkInterfaces.Where(DesiredNetworkType)
                         .Select((x, i) => new Nic(x, settings, i))
                         .ToList();
 }
示例#2
0
        private async void ReloadNetworkInterfacesAction()
        {
            IsNetworkInterfaceLoading = true;
            await Task.Delay(2000); // Make the user happy, let him see a reload animation

            string id = string.Empty;

            if (SelectedNetworkInterface != null)
            {
                id = SelectedNetworkInterface.Id;
            }

            NetworkInterfaces = await Models.Network.NetworkInterface.GetNetworkInterfacesAsync();

            SelectedNetworkInterface = NetworkInterfaces.Where(x => x.Id == id).FirstOrDefault();

            IsNetworkInterfaceLoading = false;
        }
示例#3
0
        private async void LoadNetworkInterfaces()
        {
            IsNetworkInterfaceLoading = true;

            NetworkInterfaces = await Models.Network.NetworkInterface.GetNetworkInterfacesAsync();

            // Get the last selected interface, if it is still available on this machine...
            if (NetworkInterfaces.Count > 0)
            {
                NetworkInterfaceInfo info = NetworkInterfaces.Where(s => s.Id == SettingsManager.Current.NetworkInterface_SelectedInterfaceId).FirstOrDefault();

                if (info != null)
                {
                    SelectedNetworkInterface = info;
                }
                else
                {
                    SelectedNetworkInterface = NetworkInterfaces[0];
                }
            }

            IsNetworkInterfaceLoading = false;
        }
示例#4
0
        private async void ReloadNetworkInterfacesAction()
        {
            IsNetworkInterfaceLoading = true;

            await Task.Delay(2000); // Make the user happy, let him see a reload animation (and he cannot spam the reload command)

            string id = string.Empty;

            if (SelectedNetworkInterface != null)
            {
                id = SelectedNetworkInterface.Id;
            }

            NetworkInterfaces = await Models.Network.NetworkInterface.GetNetworkInterfacesAsync();

            // Change interface...
            SelectedNetworkInterface = string.IsNullOrEmpty(id) ? NetworkInterfaces.FirstOrDefault() : NetworkInterfaces.Where(x => x.Id == id).FirstOrDefault();

            IsNetworkInterfaceLoading = false;
        }