问题描述
我有一个customActions类:
I have a customActions class:
public static ActionResult Register(Session session)
{
try
{
Do SOmething
}
catch (Exception ex)
when (ExceptionManager.catchGenericExcetion(ex))
{
var responseMessage =ex.ResponseMessage;
if (responseMessage.Contains("Maximum apps created"))
{
session.Log("maximum limit reached");
using Record record = new Record(0);
record[0] = "This is an error!Max apps reached";
session.Message(InstallMessage.Error, record);
}
return ActionResult.Failure;
}
return ActionResult.Success;
}
}
在这里,我的UI没有显示任何与session.Message(InstallMessage.Error,record)相对应的弹出窗口;但是,在MSI日志中,我可以看到打印的消息:达到最大限制
Here my UI doesn't show any popup corresponding to session.Message(InstallMessage.Error, record);However, in the MSI logs, I can see the message printed:maximum limit reached
MSI (s) (30!F4) [21:26:05:047]: Product: MyApp -- This is an error!Max apps reached
任何人都可以帮助我为什么无法在UI上看到此消息吗?我希望在安装过程中将其显示在最终用户的UI上.
Can anyone help that why I am unable to see this message on UI ? I want it to be displayed on the UI for the end user during the installation process.
推荐答案
调试或发布消息 :不确定您真正需要的是-是调试还是做想在安装过程中为最终用户交互式地显示一些东西?
Debugging or Release Message: Not sure what you really need - are you just debugging or do you want to show something interactively during installation for actual end users?
调试 :如果您要调试:将调试器附加到您的自定义项操作,如下所示显示自定义操作的消息框.然后,您可以正确地执行代码-用于快速演示的视频(也许已经为您工作):
Debugging: If you are debugging: Attach the debugger to your custom action after you show a message box from the custom action like below. Then you can step through the code properly - video for quick demo (perhaps this is already working for you):
using System.Windows.Forms;
<..>
[CustomAction]
public static ActionResult TestCustomAction(Session session)
{
MessageBox.Show("Hello from TestCustomAction");
return ActionResult.Success;
}
Session.Message :我并没有真正使用这个概念(我喜欢将信息放入日志中,而不是显示给最终用户),但是我发现了这一点工作(从这里清除- 准备好的搜索"
):
[CustomAction]
public static ActionResult TestCustomAction(Session session)
{
Record record = new Record(0);
record[0] = "This is an error! Max apps reached";
session.Message(InstallMessage.User | (InstallMessage)MessageButtons.OK | (InstallMessage)MessageIcon.Information, record);
return ActionResult.Success;
}
这篇关于Session.Message在产品安装屏幕上未显示弹出消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!