public MainPresenter(IMainView view) { this.view = view; //view.RunDecodingSerialPort += RunDecodingSerialPort; view.StopDecodingSerialPort += StopDecodingSerialPortEvent; view.ComPortConnection += ComPortConnectionEvent; view.OpenDataFile += OpenDataFileEvent; ComPortNamesUpdate(); view.ComPortName = Program.settings.SerialPort.PortName; view.CopyPointValuesToArray += CopyPointValuesToArrayEvent; view.UpdateChart += UpdateChartMainEvent; view.ExitProgramm += ExitProgrammEvent; view.ComPortNamesUpdate += ComPortNamesUpdateEvent; serialPort.DataReceived += DataReceivesEvent; //streamDecoding.NewPackageEvent += NewPackageEvent; //streamDecoding.EndDecodingStreamEvent += EndDecodingStreamEvent; fs = File.OpenWrite("xxx.bin"); //streamControl.AddStream("COM_Port", serialPort.BaseStream); if (serialPort.IsOpen) { DecodStreamPSP = new DecodingStreamPSP(serialPort.BaseStream, new PackagePSPStructure(StartBit.ZERO, 32, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12)); } //streamControl.SeleсtStream(serialPort.BaseStream); }
private void OpenDataFileEvent(object sender, EventArgs e) { using (OpenFileDialog openFileDialog = new OpenFileDialog()) { if (serialPort.IsOpen) { serialPort.Close(); } openFileDialog.Filter = "Binary voltage recoder file (*.bvr)|*.bvr"; if (openFileDialog.ShowDialog() == DialogResult.Cancel) { return; } isFileLoad = true; //serialPort.DataReceived -= DataReceivesEvent; PathFileNameBvr = openFileDialog.FileName; //streamDecoding.ClearCollectionPointValues(); view.ValueScrollChart = 0; fileStreamRead = File.OpenRead(PathFileNameBvr); //decoding = new StreamDecoding(fileStreamRead); DecodStreamPSP = new DecodingStreamPSP(fileStreamRead, new PackagePSPStructure(StartBit.ZERO, 32, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12)); UpdateChartMainEvent(sender, e); UpdateChartPreview(); } }