public void Save(DataHandler data) { BinaryFormatter bnr = new BinaryFormatter(); using (FileStream fs = new FileStream(_dataString, FileMode.Create)) { bnr.Serialize(fs, data); fs.Close(); } }
public DataHandler GetData() { DataHandler _data = new DataHandler(); BinaryFormatter bnr = new BinaryFormatter(); using (FileStream fs = new FileStream(_dataString, FileMode.Open)) { _data = (DataHandler)bnr.Deserialize(fs); fs.Close(); } return _data; }
public void App_Startup() { _listener.StartListener(); _listener.change += new VolumeMicroChange(change_value); if (File.Exists("data.dat")) { data = ser.GetData(); } _voiceSignal = data._startVoice; if (_voiceSignal == 0) { outputTextbox.Text = "_voiceSignal равен 0"; //калибровка; outputTextbox.Text = "Калибровка"; _listener._calibrate = true; cal_form.Show(); Visibility = Visibility.Hidden; } }