public MMAutomatChlid(MMAutomat a) { if (a == null) { throw new AutomatException("Automat is a 'null'!"); } InitializeComponent(); machine = a; progressBar.Minimum = 0; progressBar.Step = 1; txtIn_TextChanged(null, new EventArgs()); if (machine != null) { //machine.PrintAutomat(grid); PrintAutomat(); } }
private void openToolStripButton_Click(object sender, EventArgs e) { Automat auto = null; if (openFileDialog1.ShowDialog() == DialogResult.OK) { Form child = null; object[] A; object[] Z; object[] S; int[,] ν; //int[,] ζ; // reading automat try { StreamReader file = new StreamReader(openFileDialog1.FileName); string type = GetSplittedLine(file)[0]; A = GetSplittedLine(file); Z = GetSplittedLine(file); S = GetSplittedLine(file); switch (type) { case "MM": #region Stack-memory automat loading object[] M; int[][,] MDev; List <MMAutomatAct[]> rulesList; ReadMMFromFile(A.Length, S.Length, file, out M, out MDev, out rulesList); auto = new MMAutomat(A, Z, S, M, MDev, rulesList.ToArray()); child = new MMAutomatChlid((MMAutomat)auto); (child as MMAutomatChlid).machine.Step += new MMAutomat.MMStepDelegate(machine_Step); #endregion break; case "Mili": ν = TableRead(file, S.Length, A.Length); auto = new AutomatMili(A, Z, S, ν, TableRead(file, S.Length, A.Length)); child = new MDIChildTemplate((TerminalAutomat)auto); (child as MDIChildTemplate).machine.Step += new TerminalStepDelegate(machine_Step); break; case "Mura": ν = TableRead(file, S.Length, A.Length); auto = new AutomatMura(A, Z, S, ν, TableRead(file, S.Length)); child = new MDIChildTemplate((TerminalAutomat)auto); break; default: break; } } catch (IOException excp) { MessageBox.Show(excp.Message); return; } if (child == null) { return; } child.MdiParent = this; child.Text = openFileDialog1.FileName; child.Show(); } }