异常消息框未在异常中获取帮助按钮的问题。 [英] An issue with exception message box not getting the help button in the exception.
问题描述
大家好,
我在WPF中创建自定义控制错误消息框时遇到问题。
为了实现这一点,我想过使用Microsoft提供的Exception Message Box,
我推荐了这个博客
https://www.codeproject.com/Articles/18838/Exception -Message-Box-Using-C
并且已经在项目中实现了它的工作,但事情是消息框上的帮助按钮没有显示或者需要将它暴露给它的属性UI不可用,
对此有任何建议会有所帮助。
提前致谢。
我尝试过:
使用C#的异常消息框 [ ^ ]
有im在我们的项目中也是如此。
这些问题必须在同一条(或博客或小费帖)下提出。原因是,在该论坛上(在文章下),问题将在一个明确的背景下,作者,OP和未来的读者将知道你在说什么。
在质量保证中,你必须解释上下文,并没有真正的帮助 - 由于非主题标志,你的问题将被浪费。所以,请在文章下的论坛上提问,如果他仍然活跃,作者会非常乐意帮助你。
至于不显示是否会显示,还是有效?也许,或者按钮可能被隐藏。 :笑:
这不简单,但你可以做到。
如果你使用任何一个构造函数包含要显示的错误消息的string
,您可以设置HelpLink
属性ExceptionMessageBox
指定帮助链接。您仍然可以使用InnerException
属性来显示实际异常的完整详细信息。
var message = new ExceptionMessageBox( 出错了......)
{
HelpLink = https://www.google.com/,
InnerException = ex,
};
message.Show( this );
如果您使用任何带Exception
的构造函数,上的
被忽略。相反,帮助按钮的可见性取决于链中的任何异常是否具有 HelpLink属性 [ ^ ]设置。似乎大多数例外都没有设置此字段,因此很少显示帮助按钮。但是,它是一个可写属性,因此您可以设置它:HelpLink
ExceptionMessageBox
var error = new InvalidOperationException( 出错了...... ,ex)
{
HelpLink = https://www.google.com/ ,
};
var message = new ExceptionMessageBox(error);
message.Show( this );
(技术上,帮助链接为也可以从数据属性 [ ^ ] -HelpLink.BaseHelpUrl
指定基本URL,其键以HelpLink。
开头的任何条目都将作为查询字符串值附加。)
Hello all,
I have an issue on creation of Custom controlled Error message box in WPF.
In order to implement that, I thought of using Exception Message Box which is provided by Microsoft,
I have referred this blog
https://www.codeproject.com/Articles/18838/Exception-Message-Box-Using-C
and have implemented same in the project its working but the thing is the Help button which is on the Message Box is not displaying or the properties required to expose it to the UI is not available,
Any suggestion on this would be helpful.
Thanks in advance.
What I have tried:
Exception Message Box Using C#[^]
have implemented the same in our project.
Such questions must be asked under the same Article (or blog, or tip post). The reason is, that on that forum (under the article), question will be in a defined context and the author, OP and future readers will know what you are talking about.
In a QA, you have to explain the context, and is not really helpful — due to off-topic flags, your question will be wasted. So, please ask the question on the forum under the article and the author would be more than happy to help you out, if he is still active.
As for the "not showing" does it ever show, or does it work? Perhaps, or the button might be hidden. :laugh:
It's not simple, but you can do it.
If you use any of the constructors which take astring
containing the error message to display, you can set theHelpLink
propertyExceptionMessageBox
to specify the help link. You can still use theInnerException
property to display the full details of the actual exception.
var message = new ExceptionMessageBox("Something went wrong...") { HelpLink = "https://www.google.com/", InnerException = ex, }; message.Show(this);
If you use any of the constructors which take anException
, theHelpLink
on theExceptionMessageBox
is ignored. Instead, the visibility of the help button is determined by whether any of the exceptions in the chain have their HelpLink property[^] set. It seems that most exceptions don't have this field set, so the "help" button rarely shows up. However, it is a writeable property, so you can set it:
var error = new InvalidOperationException("Something went wrong...", ex) { HelpLink = "https://www.google.com/", }; var message = new ExceptionMessageBox(error); message.Show(this);
(Technically, the help link for an exception can also be constructed from items in the Data property[^] -HelpLink.BaseHelpUrl
specifies the base URL, and any entry whose key starts withHelpLink.
will be appended as a query-string value.)
这篇关于异常消息框未在异常中获取帮助按钮的问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!