コード例 #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;
                }
            }
        }
コード例 #2
0
        private void ShowTestScriptResults()
        {
            Debug.Assert(_clientLogic.CurrentScriptResult != null);

            if (_clientLogic.CurrentScriptResult != null)
            {
                ScriptResultViewer scriptResultViewer = new ScriptResultViewer();
                scriptResultViewer.DataContext = _clientLogic.CurrentScriptResult;
                scriptResultViewer.Owner       = this;

                scriptResultViewer.ShowDialog();
            }
        }
コード例 #3
0
        void _clientLogic_ClientLogicUI(object sender, ClientLogicUIEventArgs e)
        {
            if (this.Dispatcher.CheckAccess())
            {
                // only display result if this page initiated a request
                if ((e.UIRequest == ClientLogicUIRequest.ScriptResultsReady) && ((_scriptRunFromPage) || (_clientLogic.CurrentView == ClientLogicView.CabDetail)))
                {
                    _scriptRunFromPage = false;

                    DisplayScriptResult resultFile = listViewResultFiles.SelectedItem as DisplayScriptResult;
                    if ((resultFile != null) && (_clientLogic.CurrentScriptResult != null))
                    {
                        if (_clientLogic.CurrentScriptResult.Name == resultFile.ScriptName)
                        {
                            richTextBoxScriptResult.Document.Blocks.Clear();
                            richTextBoxScriptResult.Document.Blocks.Add(ScriptResultViewer.GetScriptResultParagraph(_clientLogic.CurrentScriptResult));
                        }
                    }

                    // begin invoke to give ClientLogic a chance to free up
                    this.Dispatcher.BeginInvoke(new Action(DoGetCabNotes));
                }
                else if (e.UIRequest == ClientLogicUIRequest.CabNotesReady)
                {
                    // if we have some notes update them
                    if (_clientLogic.CurrentCabNotes != null)
                    {
                        notesControl.UpdateNotes(_clientLogic.CurrentCabNotes);
                    }
                    else
                    {
                        notesControl.ClearNotes();
                    }
                }
                else if (e.UIRequest == ClientLogicUIRequest.CabFileReady)
                {
                    richTextBoxScriptResult.Document.Blocks.Clear();

                    if (_clientLogic.CurrentCabFileContents != null)
                    {
                        richTextBoxScriptResult.Document.Blocks.Add(new Paragraph(new Run(_clientLogic.CurrentCabFileContents)));
                    }
                }
            }
            else
            {
                this.Dispatcher.BeginInvoke(new Action <object, ClientLogicUIEventArgs>(_clientLogic_ClientLogicUI), sender, e);
            }
        }