private void listViewCabContents_SelectionChanged(object sender, SelectionChangedEventArgs e) { DisplayCabFile cabFile = listViewCabContents.SelectedItem as DisplayCabFile; if (cabFile != null) { listViewResultFiles.SelectedItem = null; // clear any existing result richTextBoxScriptResult.Document.Blocks.Clear(); textBlockPreviewHeader.Text = cabFile.FileName + ":"; if (System.IO.Path.GetExtension(cabFile.FileName).IndexOf("dmp", StringComparison.OrdinalIgnoreCase) >= 0) { richTextBoxScriptResult.Document.Blocks.Add(new Paragraph(new Run(Properties.Resources.CabDetails_PreviewUnavailable))); } else { _clientLogic.GetCabFile(cabFile.FileName, cabFile.Length); } } else { // clear result on null selection richTextBoxScriptResult.Document.Blocks.Clear(); if (listViewResultFiles.SelectedItem == null) { textBlockPreviewHeader.Text = Properties.Resources.CabDetails_NoSelectionHeader; } } }