public MainWindow() { InitializeComponent(); string FName = "qbase.dat"; BinaryFormatter formatter = new BinaryFormatter(); if (File.Exists(FName)) { using (FileStream fs = new FileStream(FName, FileMode.OpenOrCreate)) { QLearning = (TQLearning)formatter.Deserialize(fs); } } else { QLearning = new TQLearning(textBox); using (FileStream fs = new FileStream(FName, FileMode.OpenOrCreate)) { formatter.Serialize(fs, QLearning); } } Base = new TBase(); Pole = new TPole(gPole, textBox, textBox1, Base, QLearning); }
public TPole(Canvas g, TextBox tb, TextBox tbCount, TBase Base, TQLearning QL) { this.Base = Base; this.QL = QL; this.g = g; this.tb = tb; this.tbCount = tbCount; H = g.Height; g.Width = H; Init(); }