private void PopulateMainThreadArea(IMessageThread selectedThread) { try { var thread = _threadManager.GetUserThread(selectedThread, _employee); _userThread = thread ?? throw new ApplicationException("Unable to obtain thread data from database, please relog and try again."); } catch (Exception ex) { DisableThreadFields(); ExceptionLogManager.getInstance().LogException(ex); MessageBox.Show(ex.Message + "\nPlease relog your account or contact IT."); } if (!IsWindowValidForThreadOperations()) { DisableThreadFields(); return; } EnableThreadFields(); //alias dropdown cboAliasPicker.ItemsSource = null; cboAliasPicker.ItemsSource = _employee.Aliases.Where(a => a != null); cboAliasPicker.SelectedValue = _userThread.Alias; //participants list //If the participant is an object that implements ISender (this will always be true in live scenarios) then cast as such and get the email to display. lstThreadParticipants.ItemsSource = null; lstThreadParticipants.ItemsSource = _userThread.ParticipantsWithAlias.ToDictionary(kp => (kp.Key is ISender) ? (kp.Key as ISender).Email : kp.Key.Alias, kp => kp.Value); //message list lstThreadMessages.ItemsSource = null; lstThreadMessages.ItemsSource = _userThread.Messages; //bottom check boxes chkThreadHide.IsChecked = _userThread.Hidden; chkThreadSilence.IsChecked = _userThread.Silenced; }