Пример #1
0
        private void listViewResultFiles_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DisplayScriptResult resultFile = listViewResultFiles.SelectedItem as DisplayScriptResult;

            if (resultFile != null)
            {
                listViewCabContents.SelectedItem = null;

                bool currentlySelected = false;

                DateTime localRunDate = resultFile.RunDate.ToLocalTime();
                textBlockPreviewHeader.Text = string.Format(CultureInfo.CurrentCulture,
                                                            Properties.Resources.CabDetails_ScriptHeader,
                                                            resultFile.ScriptName,
                                                            localRunDate.ToShortDateString(),
                                                            localRunDate);

                // if we ald
                if (_clientLogic.CurrentScriptResult != null)
                {
                    if (_clientLogic.CurrentScriptResult.Name == resultFile.ScriptName)
                    {
                        currentlySelected = true;
                    }
                }

                if (currentlySelected)
                {
                    // refresh the results
                    if (_clientLogic.CurrentScriptResult != null)
                    {
                        richTextBoxScriptResult.Document.Blocks.Clear();
                        richTextBoxScriptResult.Document.Blocks.Add(ScriptResultViewer.GetScriptResultParagraph(_clientLogic.CurrentScriptResult));
                    }
                }
                else
                {
                    // clear any existing result
                    richTextBoxScriptResult.Document.Blocks.Clear();

                    _scriptRunFromPage = true;
                    _clientLogic.AdminGetResult(resultFile.ScriptName);
                }
            }
            else
            {
                // clear result on null selection
                richTextBoxScriptResult.Document.Blocks.Clear();

                if (listViewCabContents.SelectedItem == null)
                {
                    textBlockPreviewHeader.Text = Properties.Resources.CabDetails_NoSelectionHeader;
                }
            }
        }