コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: delateurj/PylonLog
        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();
            }
        }
コード例 #2
0
        public void createSessionLogs()
        {
            int indexOfNextLogSession = findNextSessionLog(0);

            while (indexOfNextLogSession > -1)
            {
                int indexOfLogSession = indexOfNextLogSession;

                TelemetrySession logSession = new TelemetrySession();

                logSession.mainHeader = rawData.Slice(indexOfLogSession, indexOfLogSession + Constants.HEADER_BLOCK_LENGTH);

                logSession.poplulateNameFromMainHeader();

                int indexOfLastSupplementalHeader = findLastSupplmentalHeader(indexOfLogSession);

                logSession.indexOfStartOfDataBlocks = indexOfLastSupplementalHeader + Constants.HEADER_BLOCK_LENGTH - indexOfLogSession;

                indexOfNextLogSession = findNextSessionLog(indexOfLastSupplementalHeader + Constants.HEADER_BLOCK_LENGTH);

                if (indexOfNextLogSession > -1)
                {
                    logSession.rawData = rawData.Slice(indexOfLogSession, indexOfNextLogSession);
                }
                else
                {
                    logSession.rawData = rawData.Slice(indexOfLogSession, rawData.Length);
                }

                logSession.createDataBlocksFromRawData();

                logSessions.Add(logSession);
            }
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: delateurj/PylonLog
        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);
        }