C# 我的项目找不到构造函数,即使我清楚地看到它的定义?
不管出于什么原因,下面代码的最后一行抱怨没有找到包含2个参数的InputDialog的构造函数C# 我的项目找不到构造函数,即使我清楚地看到它的定义?,c#,wpf,mahapps.metro,C#,Wpf,Mahapps.metro,不管出于什么原因,下面代码的最后一行抱怨没有找到包含2个参数的InputDialog的构造函数 using MahApps.Metro.Controls; using MahApps.Metro.Controls.Dialogs; namespace order { public static class DialogManager { public static Task<string> ShowInputAsync(this MetroWindo
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
namespace order
{
public static class DialogManager
{
public static Task<string> ShowInputAsync(this MetroWindow window, string title, string message, MetroDialogSettings settings = null)
{
window.Dispatcher.VerifyAccess();
return HandleOverlayOnShow(settings, window).ContinueWith(z =>
{
return (Task<string>)window.Dispatcher.Invoke(new Func<Task<string>>(() =>
{
if (settings == null)
settings = window.MetroDialogOptions;
//create the dialog control
InputDialog dialog = new InputDialog(window, settings); // error: does not contain a constructor With 2 arguments
显然,该类具有正确的名称,以及具有2个参数和正确类型的正确构造函数。那么是什么导致了错误呢
我基本上是在尝试改进代码,发现它有一个身份验证对话框,要求输入一个4-6位的pin码和一个密码框。因为我不应该更改MaHapps Metro代码,所以我复制并尝试修改代码以满足我的需要。类
InputDialog
的构造函数的访问修饰符必须是公共的
,而不是内部的
:
修饰符internal
表示只能在同一程序集中的文件中访问它
修饰符
public
意味着它可以被任何其他类访问,这些类可以引用InputDialog
Oops,我没有看到内部修饰符。所以我是索尔!这不是internal
的意思。
namespace MahApps.Metro.Controls.Dialogs
{
public partial class InputDialog : BaseMetroDialog
{
internal InputDialog(MetroWindow parentWindow)
: this(parentWindow, null)
{
}
internal InputDialog(MetroWindow parentWindow, MetroDialogSettings settings)
: base(parentWindow, settings)
{
InitializeComponent();
}