2014-05-18 1 views
0

이유가 무엇이든, 아래 코드의 마지막 줄에는 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 

내가주는 InputDialog에 대한 코드를 확인하고이 발견

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

은 분명히 클래스가 올바른 이름 및 2 인자와 올바른 유형의 올바른 생성자가 있습니다. 그러면 오류가 무엇입니까?

필자는 본질적으로 here 코드를 개조하여 비밀번호 상자가있는 4-6 자리 핀을 요청하는 인증 대화 상자를 갖기 위해 노력하고 있습니다. MaHapps Metro 코드를 변경해서는 안되기 때문에 필자는 필 요에 맞게 코드를 복사하고 수정하려고 시도했습니다.

답변

1

클래스 InputDialog의 생성자의 액세스 수정은 public하지 internal해야합니다 :

http://msdn.microsoft.com/en-us/library/7c5ka91b.aspx

Practical uses for the "internal" keyword in C#

수정 자 internal은 단지 동일한 어셈블리의 파일 내에서 액세스 할 수 있음을 의미합니다

수정 자 public은 b 참조 할 수있는 다른 클래스에서 액세스했습니다. InputDialog

+0

내부 수정자를 볼 수 없었습니다. 그래서 나는 SOL! – ryseagain

+0

그건 '내부'가 의미하는 것이 아닙니다. –

+0

@Eric, 네, 맞아. 업데이트 된 답변. –