public void LoadExperimentsFromDB() { this.idList.Clear(); using (SQLiteConnection connection = new SQLiteConnection("Data Source=Experiments.sqlite3")) { connection.Open(); using (SQLiteCommand command = connection.CreateCommand()) { command.CommandText = "SELECT * FROM experiment;"; using (SQLiteDataReader reader = command.ExecuteReader()) { BinaryFormatter formatter = new BinaryFormatter(); this.experimentsList = new List <Experiment>(); while (reader.Read()) { using (MemoryStream ms = new MemoryStream((byte[])reader["metropolis"])) { ms.Seek(0, SeekOrigin.Begin); this.dataInput = new DataInput((DataInput)formatter.Deserialize(ms)); this.analyticMethod = new AnalyticMethod((AnalyticMethod)formatter.Deserialize(ms)); this.inverseFunctionMethod = new InverseFunctionMethod((InverseFunctionMethod)formatter.Deserialize(ms)); this.neymanMethod = new NeymanMethod((NeymanMethod)formatter.Deserialize(ms)); this.metropolisMethod = new MetropolisMethod((MetropolisMethod)formatter.Deserialize(ms)); this.idList.Add(int.Parse(reader["id"].ToString())); this.experimentsList.Add(new Experiment(dataInput, analyticMethod, inverseFunctionMethod, neymanMethod, metropolisMethod)); } } } } } this.FillListBox(); }
public Experiment(DataInput dataInput, AnalyticMethod analyticMethodObj, InverseFunctionMethod inverseFunctionMethodObj, NeymanMethod neymanMethodObj, MetropolisMethod metropolisMethodObj) { this.dataInput = new DataInput(dataInput); this.analyticMethodObj = new AnalyticMethod(analyticMethodObj); this.inverseFunctionMethodObj = new InverseFunctionMethod(inverseFunctionMethodObj); this.neymanMethodObj = new NeymanMethod(neymanMethodObj); this.metropolisMethodObj = new MetropolisMethod(metropolisMethodObj); }