void RefreshView() { if (State.SelectedPerson == null) { return; } var messagesViewSource = new CollectionViewSource { Source = State.SelectedPerson.Messages }; messagesViewSource.SortDescriptions.Add(new SortDescription("SortDate", ListSortDirection.Descending)); var documentsViewSource = new CollectionViewSource { Source = State.SelectedPerson.Documents }; documentsViewSource.SortDescriptions.Add(new SortDescription("Filename", ListSortDirection.Ascending)); var statusUpdatesViewSource = new CollectionViewSource { Source = GetStatusUpdates() }; statusUpdatesViewSource.SortDescriptions.Add(new SortDescription("SortDate", ListSortDirection.Descending)); if (State.IsExternalSelection) { dock.SearchTextBox.Text = State.SelectedPerson.Name; } if (State.SelectedPerson.IsSoft) { State.Filter.ShowSoftContacts = true; } else if (State.Filter.ShowSoftContacts) { State.Filter.ShowSoftContacts = false; } UserProfileControl.Visibility = Visibility.Visible; SearchProfilesControl.Visibility = Visibility.Visible; MessagesColumn.OverrideViewSource(messagesViewSource); DocumentsColumn.OverrideViewSource(documentsViewSource); StatusUpdatesColumn.OverrideViewSource(statusUpdatesViewSource); UserProfileControl.Person = State.SelectedPerson; SearchProfilesControl.Person = State.SelectedPerson; }
public DetailsView() { using (new CodeTimer("ColumnSearch/Constructor")) { dock = new SearchDockControl(); mailbox = VirtualMailBox.Current; messages = new ThreadSafeCollection <Message>(); documents = new ThreadSafeCollection <Document>(); persons = new ThreadSafeCollection <Person>(); statusUpdates = new ThreadSafeCollection <UserStatus>(); messagesViewSource = new CollectionViewSource { Source = messages }; messagesViewSource.SortDescriptions.Add(new SortDescription("SortDate", ListSortDirection.Descending)); documentsViewSource = new CollectionViewSource { Source = documents }; documentsViewSource.SortDescriptions.Add(new SortDescription("Filename", ListSortDirection.Ascending)); personsViewSource = new CollectionViewSource { Source = persons }; personsViewSource.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending)); statusUpdatesViewSource = new CollectionViewSource { Source = statusUpdates }; statusUpdatesViewSource.SortDescriptions.Add(new SortDescription("SortDate", ListSortDirection.Descending)); InitializeComponent(); MessagesColumn.OverrideViewSource(messagesViewSource); DocumentsColumn.OverrideViewSource(documentsViewSource); StatusUpdatesColumn.OverrideViewSource(statusUpdatesViewSource); dock.UpdateSearch += delegate { LoadData(new ColumnSearchDataHelper { SearchQuery = dock.SearchQuery }); }; DataContext = this; } }