问题
How do we get workgroup name from windows 10 in uwp
and all other attribute of user?
回答1:
There is a User class available (UWP): https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.user.aspx
There you can find the attributes of the user
回答2:
You can use NetworkInformation class
For example to get computer name use:
var hostNames = NetworkInformation.GetHostNames();
var localName = hostNames.FirstOrDefault(name => name.DisplayName.Contains(".local"));
var computerName = localName.DisplayName.Replace(".local", "");
Or you can also use ConnectionProfile to get information about network.
Try something like this:
var result = NetworkInformation.GetConnectionProfiles();
foreach (var connectionProfile in result)
{
foreach (var networkName in connectionProfile.GetNetworkNames())
{
// use networkName;
}
}
来源:https://stackoverflow.com/questions/36692062/how-do-we-get-workgroup-name-from-windows-10-in-uwp