2012-05-03 1 views
1

사용자 입력, 삭제 및 취소를 저장하기위한 버튼이있는 WPF 양식이 있습니다. 사용자가 취소 버튼을 클릭 할 때마다 팝업 메시지가 표시되는 기능을 추가하려고했습니다. 대신 내 컨트롤러에서 예외가 발생합니다 : 여기 다음 메서드 또는 속성 사이에 호출이 모호합니다. - WPF

"The call is ambiguous between the following methods or properties" 

내이다 :

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,0">       
    <Button Name="DeleteButton" Command="{Binding DeleteCommand}" CommandParameter="{Binding Path=SelectedStory}" Cursor="Hand" Height="25" IsEnabled="{Binding CanDelete}" Margin="5 0 0 0">Delete</Button> 
    <Button Name="SubmitButton" Command="{Binding SubmitCommand}" CommandParameter="{Binding Path=SelectedStory}" Cursor="Hand" Height="25" Margin="5 0 0 0">Submit</Button> 
    <Button Name="CancelButton" Command="{Binding CloseCommand}" CommandParameter="{Binding Path=SelectedStory}" Cursor="Hand" Height="25" Margin="5 0 0 0" >Cancel</Button> 
</StackPanel> 

내 컨트롤러 코드 :

당신이 얻고있는 예외는 그것이 '아무튼 있음을 나타냅니다
public MetadataController(IGatewayService gateway, IEventAggregator eventAggregator, IDialogService dialog) 
    { 
     this.gateway = gateway; 
     this.eventAggregator = eventAggregator; 
     this.dialog = dialog; 

     // commands    
     this.CloseCommand = new DelegateCommand<StoryItem>(this.Close);//here i got the exception throwing "the call is ambiguous between the following methods or properties" 
     this.DeleteCommand = new DelegateCommand<StoryItem>(this.Delete); 
     this.SubmitCommand = new DelegateCommand<StoryItem>(this.Submit, this.HasFieldsRequiredBeforeSubmit); 

     this.eventAggregator.GetEvent<StorySelectedEvent>().Subscribe(OnStorySelected); 
    } 

    private void Close(StoryItem selsectedStory)//when i click my close button its not calling this method at all. 
    { 
     bool isConfirmed = this.dialog.ShowConfirmation("Are you sure you want to close?"); 
    } 

    private void Delete(StoryItem selectedStory) 
    { 
     bool isConfirmed = this.dialog.ShowConfirmation("Are you sure you want to permanently delete ?"); 

     if (isConfirmed) 
     { 
      this.gateway.DeleteStoryItem(selectedStory); 

      this.eventAggregator.GetEvent<CommandCompletedEvent>().Publish(CommandTypes.MetadataEntry); 
     } 
    } 
+0

미안 해요, 내 나쁜 이미 그 예외를 throw하는 이유는 그 작업을 예상대로 던져 동일한 클래스에 다른 방법이 있습니다 – Usher

답변

0

예외가 발생한 이유는 이미 메소드가 있기 때문에 하나를 작성하려고했기 때문에 오류가 발생합니다. 도움 팀에게 많은 감사를드립니다.

2

호출하려는 메소드/속성에 액세스하는 방법. 아마도 Close 또는 CloseCommand라고도하며 충돌을 일으키는 다른 방법이나 속성이있을 수 있습니까?

+0

죄송합니다, 대문자 'C'닫기 메서드를 변경하는 것을 잊어 버렸습니다. 내 코드에서 UpperCase 'C'하지만 난 던져 오류가 @ this.CloseCommand = 새 DelegateCommand (this.Close); // 여기에 "전화가 다음 메서드 또는 속성 사이에 모호한 던지고 예외가" – Usher

관련 문제