public ReplayData loadFile(string filename) { Stream inputStream = File.OpenRead(filename); BinaryFormatter inputFormatter = new BinaryFormatter(); mData = ( ReplayData )inputFormatter.Deserialize(inputStream); mMaxIndex = mData.mDataList.Count; mCurrentState = DataPlayerState.Ready; return(mData); }
private void btnReplay_Click(object sender, EventArgs e) { OpenFileDialog openDialog = new OpenFileDialog(); openDialog.Filter = "Sensor Data|*.imu"; openDialog.Title = "Load sensor replay data"; DialogResult result = openDialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { SensorDataPlayer sdp = new SensorDataPlayer(); ReplayData data = sdp.loadFile(openDialog.FileName); LiveDataDisplayForm Replay = new LiveDataDisplayForm(sdp, data.mCalibrationData, data.mSensorBoneMapping); BindingList <SensorDataEntry> blist = new BindingList <SensorDataEntry>(data.mDataList); dataGridView1.DataSource = blist; Replay.Show(); Replay.begin(); } }