private void btnUpdateAvgRPM_Click(object sender, RoutedEventArgs e) { PylonLogEntry selectedEntry = (PylonLogEntry)dgPylonLog.SelectedItem; if (selectedEntry != null) { if (selectedEntry.endTimeStamp != 0) { selectedEntry.avgRPM = (int)(selectedEntry.averageOfSpecifiedValueType("RPM", 100 * selectedEntry.launchTimeStamp, 100 * selectedEntry.endTimeStamp)); } else { selectedEntry.avgRPM = (int)(selectedEntry.averageOfSpecifiedValueType("RPM", 100 * selectedEntry.launchTimeStamp)); } } }
private void btnOpenCreateLogEntry_Click(object sender, RoutedEventArgs e) { TelemetrySession selectedLogSession = (TelemetrySession)lstBxLogSessions.SelectedItem; PylonLogEntry previous = pylonLogEntry; pylonLogEntry = new PylonLogEntry(); pylonLogEntry.planeName = selectedLogSession.planeName; pylonLogEntry.humidity = previous.humidity; pylonLogEntry.temperature = previous.temperature; pylonLogEntry.prop = previous.prop; pylonLogEntry.plugType = previous.plugType; pylonLogEntry.engine = previous.engine; pylonLogEntry.entryType = previous.entryType; foreach (DataBlock dataBlock in selectedLogSession.dataBlocks) { if (dataBlock.dataValue != 0) { pylonLogEntry.DataBlocks.Add(dataBlock.shallowClone()); } } pylonLogEntry.avgRPM = (int)(pylonLogEntry.averageOfSpecifiedValueType("RPM")); pylonLogEntry.telemetryDuration = selectedLogSession.duration; GlobalDataContext.pylonLogContext.pylonLogEntries.Add(pylonLogEntry); GlobalDataContext.pylonLogContext.SaveChanges(); spektrumLog.logSessions.Remove(selectedLogSession); this.dgPylonLog.Focus(); dgPylonLog.SelectedItem = this.dgPylonLog.Items.MoveCurrentToLast(); dgPylonLog.ScrollIntoView(dgPylonLog.SelectedItem); }
private void dgCmboEngine_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { // if(dgPylonLog.IsLoaded) // { if (((System.Windows.Controls.ComboBox)sender).SelectedValue != null) { string SelectedText = ((System.Windows.Controls.ComboBox)sender).SelectedValue.ToString(); int defaultHead = GlobalDataContext.pylonLogContext.engines.First(c => c.serialNumber == SelectedText).headHeight; int defaultDeck = GlobalDataContext.pylonLogContext.engines.First(c => c.serialNumber == SelectedText).deckClearance; if (dgPylonLog.SelectedItem != null && dgPylonLog.SelectedItem.ToString() != "{NewItemPlaceholder}") { PylonLogEntry currentRow = (PylonLogEntry)dgPylonLog.SelectedItem; currentRow.headHeight = defaultHead; currentRow.deckClearance = defaultDeck; } // } } }
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(); } } }