private void logSessionsListBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { GraphWindow graphWindow = new GraphWindow(); WindowsFormsHost host = new WindowsFormsHost(); TelemetrySession selectedLogSession = (TelemetrySession)lstBxLogSessions.SelectedItem; if (selectedLogSession != null) { List <Double[]> firstGraphData = selectedLogSession.getSelectedDataBlocks("RPM"); List <Double[]> secondGraphData = selectedLogSession.getSelectedDataBlocks("RX-VOLT"); graph = new PylonLogGraphUserControl.PylonLogGraphUserControl(firstGraphData, secondGraphData); host.Child = graph; graphWindow.Left = this.Left; graphWindow.Top = this.Top + this.ActualHeight; graphWindow.MainGrid.Children.Add(host); graphWindow.Width = graph.Width; graphWindow.Height = graph.Height; graphWindow.Title = selectedLogSession.ToString() + " Non zero rpm:" + selectedLogSession.numberOfNonZeroDataBlocksOfThisDataType("RPM"); graphWindow.Show(); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (dgPylonLog.SelectedItem != null && dgPylonLog.SelectedItem.ToString() != "{NewItemPlaceholder}") { PylonLogEntry selectedEntry = (PylonLogEntry)dgPylonLog.SelectedItem; if (selectedEntry != null) { GraphWindow graphWindow = new GraphWindow(); WindowsFormsHost host = new WindowsFormsHost(); List <Double[]> firstGraphData = selectedEntry.getSelectedDataBlocks("RPM"); List <Double[]> secondGraphData = selectedEntry.getSelectedDataBlocks("RX-VOLT"); graph = new PylonLogGraphUserControl.PylonLogGraphUserControl(firstGraphData, secondGraphData); host.Child = graph; graphWindow.Left = this.Left; graphWindow.Top = this.Top + this.ActualHeight; graphWindow.MainGrid.Children.Add(host); graphWindow.Width = graph.Width; graphWindow.Height = graph.Height; graphWindow.Title = selectedEntry.ToString() + " Non zero rpm:" + selectedEntry.numberOfNonZeroDataBlocksOfThisDataType("RPM"); graphWindow.Show(); } } }