internal void LoadScenario(string filename) { try { if (System.IO.Path.GetExtension(filename).ToLower() == ".scnx") { ScenarioControl newScenarioControl = new ScenarioControl(); TestScenario loadedScenario = TestScenario.Load(filename); newScenarioControl.FillTree(loadedScenario); tabbedDocumentControl.Items.Add(System.IO.Path.GetFileNameWithoutExtension(filename), newScenarioControl); tabbedDocumentControl.SelectedControl = tabbedDocumentControl.Items[tabbedDocumentControl.Items.Count - 1]; } else if (System.IO.Path.GetExtension(filename).ToLower() == ".qlog") { LogViewerControl logViewerControl = new LogViewerControl(); logViewerControl.Filename = filename; tabbedDocumentControl.Items.Add("Log - " + System.IO.Path.GetFileNameWithoutExtension(filename), logViewerControl); tabbedDocumentControl.SelectedControl = tabbedDocumentControl.Items[tabbedDocumentControl.Items.Count - 1]; } } catch (Exception ex) { MessageBox.Show("Could not load '" + filename + "'\n" + ex.Message, "Error While Loading"); } }
public void TestCtor() { var source = new SingleDataSourceViewModel( new SingleDataSource(_logFileFactory, _scheduler, new DataSource("Foobar") { Id = DataSourceId.CreateNew() }), _actionCenter.Object); source.LevelsFilter = LevelFlags.All; var control = new LogViewerControl { DataSource = source }; control.ShowOther.Should().BeTrue(); control.ShowTrace.Should().BeTrue(); control.ShowDebug.Should().BeTrue(); control.ShowInfo.Should().BeTrue(); control.ShowWarning.Should().BeTrue(); control.ShowError.Should().BeTrue(); control.ShowFatal.Should().BeTrue(); }
internal void openToolStripButton_Click(object sender, EventArgs e) { DialogResult dialogResult = openFileDialog.ShowDialog(); if (dialogResult == DialogResult.OK) { foreach (string filename in openFileDialog.FileNames) { try { if (System.IO.Path.GetExtension(filename).ToLower() == ".scnx") { ScenarioControl newScenarioControl = new ScenarioControl(); TestScenario loadedScenario = TestScenario.Load(filename); newScenarioControl.FillTree(loadedScenario); tabbedDocumentControl.Items.Add(System.IO.Path.GetFileNameWithoutExtension(filename), newScenarioControl); tabbedDocumentControl.SelectedControl = tabbedDocumentControl.Items[tabbedDocumentControl.Items.Count - 1]; } else if (System.IO.Path.GetExtension(filename).ToLower() == ".qlog") { LogViewerControl logViewerControl = new LogViewerControl(); logViewerControl.Filename = filename; tabbedDocumentControl.Items.Add("Log - " + System.IO.Path.GetFileNameWithoutExtension(filename), logViewerControl); tabbedDocumentControl.SelectedControl = tabbedDocumentControl.Items[tabbedDocumentControl.Items.Count - 1]; } } catch (Exception ex) { MessageBox.Show("Could not load '" + filename + "'\n" + ex.Message, "Error While Loading"); } } } }
private string GetLog() { LogViewerControl.CopyToClipboard(); var dataObject = Clipboard.GetDataObject(); if (dataObject == null) { return(string.Empty); } return(dataObject.GetData(DataFormats.Text).ToString()); }
protected override void OnLogResultArrived(string logFile) { if (control != null) { if (control.InvokeRequired) { control.Invoke(new LogResultArrivedCallback(OnLogResultArrived), logFile); } else if (System.IO.File.Exists(logFile)) { string title = string.Empty; if (control.currentPlayingScenarioControl != null) { title = "Log - " + control.currentPlayingScenarioControl.TestScenario.RootTestCase.Name; } else { title = "Log - " + System.IO.Path.GetFileNameWithoutExtension(logFile); } foreach (Control c in control.dockManager.tabbedScenarioControl.tabbedDocumentControl.Items) { LogViewerControl lvc = c as LogViewerControl; if (lvc != null) { if (string.Compare(title, control.dockManager.tabbedScenarioControl.tabbedDocumentControl.ItemTitles[lvc]) == 0) { lvc.Filename = logFile; if (Properties.Settings.Default.ShowLogAfter) { control.dockManager.tabbedScenarioControl.tabbedDocumentControl.SelectedControl = lvc; } return; } } } LogViewerControl logViewerControl = new LogViewerControl(); logViewerControl.Filename = logFile; control.dockManager.tabbedScenarioControl.tabbedDocumentControl.Items.Add(title, logViewerControl); if (Properties.Settings.Default.ShowLogAfter) { control.dockManager.tabbedScenarioControl.tabbedDocumentControl.SelectedControl = logViewerControl; } } } }
/// <summary> /// Constructor. /// </summary> /// <param name="parameters">Parameters.</param> public LogViewerDocument(Project project, LogListener parameters) { if (project == null) { throw new ArgumentNullException("project"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } Project = project; View = new LogViewerControl(); View.SelectedLogChanged += View_SelectedLogChanged; _logNodeManager = new TreeViewNodeManager(View.LogContentData); Parameters = parameters; }
public void SetUp() { _settings = new Mock <IApplicationSettings>(); _dataSource = CreateViewModel( new FileDataSource(_logSourceFactory, _scheduler, new DataSource("Foobar") { Id = DataSourceId.CreateNew() })); _control = new LogViewerControl { DataSource = _dataSource, Width = 1024, Height = 768 }; DispatcherExtensions.ExecuteAllEvents(); }
internal void CloseItem(object sender, EventArgs e) { try { ScenarioControl currentScenarioControl = tabbedDocumentControl.SelectedControl as ScenarioControl; if (currentScenarioControl != null) { tabbedDocumentControl.Items.Remove(currentScenarioControl); } else { LogViewerControl currentLogViewControl = tabbedDocumentControl.SelectedControl as LogViewerControl; if (currentLogViewControl != null) { tabbedDocumentControl.Items.Remove(currentLogViewControl); } } } catch (Exception ex) { MessageBox.Show("Could not close!\n" + ex.Message, "Error While Closing"); } }
private void CopyToClipboard() { LogViewerControl.CopyToClipboard(); }
public void Clear() { LogViewerControl.Clear(); }
private void ClearLog_OnClick(object sender, RoutedEventArgs e) { LogViewerControl.Clear(); }