Dotnet 安装项目 - 从代码更改用户安装首选项
我遇到一个问题,当我们尝试在 dot net 中安装设置项目时,会出现一个如下所示的窗口。
当我们安装此设置时,我做了一些代码片段来显示拥有以下权限的用户的名称:当前已登录系统,根据以上选择。
public override void Commit(System.Collections.IDictionary savedState)
{
base.Commit(savedState);
string appPath = Context.Parameters["AssemblyPath"].ToString();
#region Automatically Launch Application After Install
try
{
// Sending the value 2, repersenting it is from the pvMonitor.msi
System.Threading.Thread.Sleep(500);
System.Diagnostics.Process.Start(appPath);
}
catch { }
#endregion
}
当我选择“仅我”单选按钮时,将显示当前用户的名称,当我选择每个单选按钮时,将显示系统名称,如下面给出的屏幕截图所示。
我的要求是,即使我们选择“EVERY ONE”单选按钮,当前登录的用户名也应该是得到显示,但每个功能都相同,因为我不希望每个用户在登录时安装此设置,即此设置应在系统中安装一次。请提出一些想法。
I got an issue in which when we try to install the set up project in dot net ,a window will appear like the one given below.
When we install this set up, I had done some code snippet to display the name of the User who had logged in to the system currently, based on the above selection.
public override void Commit(System.Collections.IDictionary savedState)
{
base.Commit(savedState);
string appPath = Context.Parameters["AssemblyPath"].ToString();
#region Automatically Launch Application After Install
try
{
// Sending the value 2, repersenting it is from the pvMonitor.msi
System.Threading.Thread.Sleep(500);
System.Diagnostics.Process.Start(appPath);
}
catch { }
#endregion
}
When I select ‘ just me’ radio button the name of the current user is getting displayed and when I select every one radio button, the System name is getting Displayed like the screen shot given below.
My requirement is that even if we select the EVERY ONE radio button, the current logged in User’s name should be get displayed but with the same functionality of every one ,Since I don’t want every user to install this set up when he logs in, ie this set up should be installed in a system once .Plz suggest some Ideas.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 System.Security.Principal.WindowsIdentity.GetCurrent().Name; 获取当前用户名。
然后,显示
名称
(即使用户选择“Every One”)You may get the current user name using
System.Security.Principal.WindowsIdentity.GetCurrent().Name;
.Then, display the
name
(even if the user selected 'Every One')