private void изФайлаToolStripMenuItem_Click(object sender, EventArgs e) { if (!hasChilds && cube != null) { hasChilds = true; OpenFileDialog subform = new OpenFileDialog(); subform.ShowDialog(); string filename = subform.FileName; if (filename != null && filename != "") { StreamReader sr = new StreamReader(filename); string cubant; while ((cubant = sr.ReadLine()) != null) { cubant = CoordinatesActions.CubantRecord2Code(cubant); if (cubant.Length == Basis.Length) { cube.setCubant(cubant, Constants.CubantSphereColor, Constants.CubantCylinderColor, Constants.BordersColor); } } sr.Close(); } //cube.setCubant("22200", Constants.CubantSphereColor, Constants.CubantCylinderColor, Constants.BordersColor); //cube.setCubant("21220", Constants.CubantSphereColor, Constants.CubantCylinderColor, Constants.BordersColor); } hasChilds = false; }
private void button1_Click(object sender, EventArgs e) { string str = textBox1.Text; string code = CoordinatesActions.CubantRecord2Code(str); if (code.Length == MainForm.Basis.Length) { for (int i = 0; i < code.Length; i++) { if (code[i] != '0' && code[i] != '1' && code[i] != '2') { return; } } MainForm.cube.setCubant(code, Constants.CubantSphereColor, Constants.CubantCylinderColor, Constants.BordersColor); button2_Click(this, new EventArgs()); } }