开发者

Visual Studio 2008 Extensibility package Toolwindow needs to display User Name

开发者 https://www.devze.com 2023-01-26 07:08 出处:网络
I have a proof of concept project and as part of it I need to identify the best way to display the User Name(the person logged on the PC) on the ToolWindow.

I have a proof of concept project and as part of it I need to identify the best way to display the User Name(the person logged on the PC) on the ToolWindow. The idea is to get this from the client and not the server or service. The package is to be VS 2008 first, then I need to do it in VS 2010 next. I am using WPF as the preferred UI. I am about a week into learning the ins and outs of VSX and appreciate all开发者_开发百科 guidance. Thanks, Danny


Ok, I got the answer. Very simple,

System.Security.Principal.WindowsIdentity currentUser = System.Security.Principal.WindowsIdentity.GetCurrent();

string loginName = currentUser.Name; tb1.Text = loginName;

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号