コード例 #1
0
        private void LoadTestInfo()
        {
            SettingManager settingManager = new SettingManager();

            if (testInfo != null)
            {
                DataLogger dataLogger = new DataLogger(testInfo.TestTime);
                if (!settingManager.LoadRatios(dataLogger.ratiosFilePath, out ratios))
                {
                    MessageBox.Show("加载系数配置文件失败", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                List <SlowPacket>   slowPacketList = dataLogger.LoadSlowBinaryFile(dataLogger.slowPacketFilePath);
                List <FastPacket>   fastPacketList = dataLogger.LoadFastBinaryFile(dataLogger.fastPacketFilePath);
                List <TailPacketRs> tailPacketList = dataLogger.LoadTailBinaryFile(dataLogger.tailPacketFilePath);
                DrawSlowPackets(slowPacketList);
                DrawFastPackets(fastPacketList);
                DrawTailPackets(tailPacketList);
                dataLogger.LoadFlyBinaryFile(dataLogger.flyPacketFilePath, out List <NavData> navDataList, out List <AngleData> angleDataList,
                                             out List <ProgramControlData> prgramDataList, out List <ServoData> servoDataList);
                DrawNavData(navDataList);
                DrawAngelData(angleDataList);
                DrawProgramData(prgramDataList);
                DrawServoData(servoDataList);
            }
            else
            {
                if (!settingManager.LoadRatios(out ratios))
                {
                    MessageBox.Show("加载系数配置文件失败", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                DataLogger        dataLogger     = new DataLogger();
                List <SlowPacket> slowPacketList = dataLogger.LoadSlowBinaryFile(slowBinFile);
                if (File.Exists(slowBinFile) && slowPacketList.Count == 0)
                {
                    MessageBox.Show("缓变参数文件未能解析出数据,请确认文件格式正确", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                List <FastPacket> fastPacketList = dataLogger.LoadFastBinaryFile(fastBinFlie);
                if (File.Exists(fastBinFlie) && fastPacketList.Count == 0)
                {
                    MessageBox.Show("速变参数文件未能解析出数据,请确认文件格式正确", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                List <TailPacketRs> tailPacketList = dataLogger.LoadTailBinaryFile(tailBinFile);
                if (File.Exists(tailBinFile) && tailPacketList.Count == 0)
                {
                    MessageBox.Show("尾段参数文件未能解析出数据,请确认文件格式正确", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                DrawSlowPackets(slowPacketList);
                DrawFastPackets(fastPacketList);
                DrawTailPackets(tailPacketList);
                dataLogger.LoadFlyBinaryFile(flyBinFile, out List <NavData> navDataList, out List <AngleData> angleDataList,
                                             out List <ProgramControlData> prgramDataList, out List <ServoData> servoDataList);
                if (File.Exists(flyBinFile) && navDataList.Count == 0 && angleDataList.Count == 0 && prgramDataList.Count == 0 &&
                    servoDataList.Count == 0)
                {
                    MessageBox.Show("飞控数据文件未能解析出数据,请确认文件格式正确", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                DrawNavData(navDataList);
                DrawAngelData(angleDataList);
                DrawProgramData(prgramDataList);
                DrawServoData(servoDataList);
            }
        }