private ListBoxItem searchResultItem(SearchResult item) { SearchResultUI result = new SearchResultUI(); result.QueryString = SearchString; result.Result = item; result.Selected += item_Selected; result.MouseDoubleClick += item_MouseDoubleClick; return(result); }
private void ShowSelection(SearchResultUI item) { SearchResult result = item.Result; if (result.RepresentingObject == RepresentingObject.Appointment) { //Appointment appointment = AppointmentDatabase.GetAppointment(result.ID); //if (!appointment.IsRepeating) if (!result.Recurring) { NavigateAppointmentEvent(new NavigateAppointmentEventArgs(result.Date.Value, result.ID)); } else { Appointment appointment = AppointmentDatabase.GetAppointment(result.ID); DateTime now = DateTime.Now.Date; DateTime?date = appointment.GetNextRecurrence(now.AddDays(-1)); if (date == null) { date = appointment.GetPreviousRecurrence(now.AddDays(1)); } NavigateAppointmentEvent(new NavigateAppointmentEventArgs(date.Value, result.ID)); } } else if (result.RepresentingObject == RepresentingObject.Contact) { NavigateContactEvent(new NavigateContactEventArgs(result.ID)); } else if (result.RepresentingObject == RepresentingObject.Task) { NavigateTaskEvent(new NavigateTaskEventArgs(result.ID)); } else if (result.RepresentingObject == RepresentingObject.Note) { NavigateNoteEvent(new NavigateNoteEventArgs(result.ID)); } }