내부에 저장된 날짜로 observablecollection을 필터링하려고합니다. 사용자는 캘린더보기를 사용하여 날짜를 선택합니다.작업 <ObservableCollection <AppointmentItem >>에 정의가 없습니다.
public async Task RefreshItems(bool showActivityIndicator, bool syncItems)
{
using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator))
{
var items = manager.GetAppointmentItemsAsync();
CalendarVM vm = new CalendarVM();
calendar.SetBinding(Calendar.DateCommandProperty, nameof(vm.DateChosen));
calendar.SetBinding(Calendar.SelectedDateProperty, nameof(vm.DateSelected));
calendar.BindingContext = vm;
var filtered = items.Where(appointmentItem => appointmentItem.Date == SelectedDate);
}
}
다음은 사용자가 선택한 날짜와 데이터가있는 AppointmentPage 클래스의 코드입니다.
public async Task<ObservableCollection<AppointmentItem>> GetAppointmentItemsAsync(bool syncItems = false)
{
try
{
IEnumerable<AppointmentItem> items = await appointmentTable
.ToEnumerableAsync();
return new ObservableCollection<AppointmentItem>(items);
}
catch (MobileServiceInvalidOperationException msioe)
{
Debug.WriteLine(@"Invalid sync operation: {0}", msioe.Message);
}
catch (Exception e)
{
Debug.WriteLine(@"Sync error: {0}", e.Message);
}
return null;
}
그리고 여기서 데이터베이스에서 데이터를 검색하는 데 사용되는 dataManger 클래스의 코드입니다.
현재는이 오류가 무엇입니까 : 나는 당신이 추가 할 수 있습니다
var items = manager.GetAppointmentItemsAsync();
다음
ObservableCollection<AppointmentItem> items = await manager.GetAppointmentItemsAsync();
에 변경하려고
Error CS1061 'Task>' does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'Task>' could be found (are you missing a using directive or an assembly reference?
나는 또한 당신을 사랑합니다 : D –
@glenncooper 젠장, 저! 나는 너무 많은 질문에 답을 했으므로 아무도 나를 사랑한다고 말하지 않았다. 질투심을 느낀다. – CodingYoshi