저는 Windows 7을 프로그래밍 할 때 새로운 기능을 가지고 있지만 한 가지 문제에 3 일을 소비하고 있습니다. 나는 모든 인터넷을 검색하고 좋은 설명을 얻지 만 운 없이는 - 그것은 내 프로그램에서 작동하지 않는다. (NULL NVARCHAR (30))WCF를 사용하여 Windows Azure를 Windows Phone 7에 연결
- ID
- 카테고리 (null이 아니고 PK)
- : 나 구조 dbo.Messenger 불리는 SQL 애저 하나 개의 테이블에 작성
메시지 (NULL NVARCHAR (200)) (NULL NVARCHAR (최대))
- 설명
는 그때 WC 그것을 만들기
[DataMember]
public int id {get; set; }
그래서이 후에 내가 WP7하게
: cource의[OperationContract] List<NoteDto> GetNotes();
public List<NoteDto> GetNotes()
{
using (var context = new WP7mgrEntities())
{
var notes = (from eachNote in context.Messenger
orderby eachNote.id ascending
select new NoteDto
{
id = eachNote.id,
category= eachNote.category,
description= eachNote.description,
message= eachNote.message,
}
).ToList();
return notes;
}
}
추가 클래스 NoteDto에 다음과 같이 각 DataMember를 위해 가지고 : F는 나에게 그 목록을 지참해야 wchich 목록 상자를 얻을 수있는 응용 프로그램은 또한 버튼 2를 클릭하십시오.
<ListBox Height="431" HorizontalAlignment="Left" Margin="12,199,0,0" Name="listBox1" VerticalAlignment="Top" Width="438"
ItemsSource="{Binding Notes}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding category}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
01 23,516,
그리고이의 뒤에 코드 :
private void button2_Click(object sender, RoutedEventArgs e)
{
Service1Client client = new Service1Client();
client.GetNotesCompleted += new EventHandler<GetNotesCompletedEventArgs>(client_GetNotesCompleted);
this.Notes = new ObservableCollection<NoteDto>();
}
private ObservableCollection<NoteDto> _notes;
public ObservableCollection<NoteDto> Notes
{
get { return _notes; }
set { _notes = value;
this.RaisePropertyChanged("Notes");
}
}
공개 이벤트 PropertyChangedEventHandler하여 PropertyChanged; 개인 무효 RaisePropertyChanged (string propertyName) { PropertyChangedEventHandler propertyChanged = this.PropertyChanged; if ((propertyChanged! = null)) { propertyChanged (this, 새 PropertyChangedEventArgs (propertyName)); 나는 데이터베이스에서 레코드에 의해 기입되지 않은 버튼이 내 목록 상자를 클릭 } }
void client_GetNotesCompleted(object sender, GetNotesCompletedEventArgs e)
{this.Notes = e.Result; }
.
아이디어가 있으십니까? Plz 도움이?
당신은 정말 당신의 코드가 메모를 얻기 위해 실패 여부 또는 화면이 변화 대응에 실패 유무를 알 수없는, 그것은 도움이 바랍니다. 나는 this.Notes를 고정 값으로 설정하기 위해 button2_Click을 변경했습니다. – Rich
설정하는 방법? – HelpMyProgram
나는 button2_Click과 비슷한 것을 말하고있다. this.Notes = new List {new NoteDto {id = 1, category = "Foo"}}; 디버깅 101. 어떤 부분이 실패하고 있는지 보여줍니다. 그런 다음 이유를 알아보십시오. –
Rich