Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 我的项目找不到构造函数,即使我清楚地看到它的定义?_C#_Wpf_Mahapps.metro - Fatal编程技术网

C# 我的项目找不到构造函数,即使我清楚地看到它的定义?

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

不管出于什么原因,下面代码的最后一行抱怨没有找到包含2个参数的InputDialog的构造函数

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();
        }