gpt4 book ai didi

c# - visual studio 2010 中的 mahapps 对话框

转载 作者:太空宇宙 更新时间:2023-11-03 15:33:37 24 4
gpt4 key购买 nike

我想在检索时显示带有用户友好消息的进度对话框数据。我正在使用 visual studio 2010。我尝试使用此代码

/// <summary>
/// Shows a progress message to the user.
/// </summary>
/// <param name="header">The header text for the dialog.</param>
/// <param name="message">The message to be displayed in the dialog.</param>
void ShowProgressMessage(string header, string message)
{
_isMessageDialogVisible = true;

_controller = _metroWindow.ShowProgressAsync(header, message);
}

/// <summary>
/// Closes a message dialog that is visible.
/// </summary>
void CloseProgressMessage()
{
if (_isMessageDialogVisible)
{
_isMessageDialogVisible = false;
if (null != _controller)
{
var controller = _controller.Result;
controller.CloseAsync();
}
}
}

但它给出了一个错误:

22 09 2015 [9] DEBUG - OPGSpiral Error App.AppDispatcherUnhandledException --- System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.

在 MahApps.Metro.Controls.Dialogs.BaseMetroDialog.HandleTheme() 在 MahApps.Metro.Controls.Dialogs.BaseMetroDialog.Initialize() 在 MahApps.Metro.Controls.Dialogs.BaseMetroDialog..ctor(MetroWindow owningWindow,MetroDialogSettings 设置) 在 MahApps.Metro.Controls.Dialogs.ProgressDialog..ctor(MetroWindow parentWindow,MetroDialogSettings 设置) 在 MahApps.Metro.Controls.Dialogs.ProgressDialog..ctor(MetroWindow parentWindow) 在 MahApps.Metro.Controls.Dialogs.DialogManager.<>c__DisplayClass43.b__3b() --- 内部异常堆栈跟踪结束 --- 在 System.RuntimeMethodHandle.InvokeMethod(对象目标,对象 [] 参数,签名 sig, bool 构造函数) 在 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(对象 obj,对象 [] 参数,对象 [] 参数) 在 System.Delegate.DynamicInvokeImpl(Object[] args) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托(delegate)回调,对象参数,Int32 numArgs) 在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(对象源、委托(delegate)回调、对象参数、Int32 numArgs、委托(delegate) catchHandler)22 09 2015 [9] DEBUG - OPGSpiral Error App.AppDispatcherUnhandledException --- System.Reflection.TargetInvocationException:调用目标抛出异常。 ---> System.NullReferenceException:对象引用未设置为对象的实例。 在 MahApps.Metro.Controls.Dialogs.BaseMetroDialog.HandleTheme() 在 MahApps.Metro.Controls.Dialogs.BaseMetroDialog.Initialize() 在 MahApps.Metro.Controls.Dialogs.BaseMetroDialog..ctor(MetroWindow owningWindow,MetroDialogSettings 设置) 在 MahApps.Metro.Controls.Dialogs.ProgressDialog..ctor(MetroWindow parentWindow,MetroDialogSettings 设置) 在 MahApps.Metro.Controls.Dialogs.ProgressDialog..ctor(MetroWindow parentWindow) 在 MahApps.Metro.Controls.Dialogs.DialogManager.<>c__DisplayClass43.b__3b() --- 内部异常堆栈跟踪结束 --- 在 System.RuntimeMethodHandle.InvokeMethod(对象目标,对象 [] 参数,签名 sig, bool 构造函数) 在 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(对象 obj,对象 [] 参数,对象 [] 参数) 在 System.Delegate.DynamicInvokeImpl(Object[] args) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托(delegate)回调,对象参数,Int32 numArgs) 在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(对象源、委托(delegate)回调、对象参数、Int32 numArgs、委托(delegate) catchHandler)

最佳答案

这应该在 1.2.2 中修复,可通过 NuGet 获得.

关于c# - visual studio 2010 中的 mahapps 对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32722386/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com