private void OpenForm(string formName, bool isTest, bool codec = true) { if (formName.Equals("Код Элайеса")) { if (codec) { SystematicCode.ElaesaCode.FormElaesaTest1 form = new SystematicCode.ElaesaCode.FormElaesaTest1(isTest); form.Show(); } else { SystematicCode.ElaesaCode.FormElaesaTest5 form = new SystematicCode.ElaesaCode.FormElaesaTest5(isTest); form.Show(); } } else if (formName.Equals("Код Варшамова")) { if (codec) { SystematicCode.VarshamovaCode.FormVarshamovaTest1 form = new SystematicCode.VarshamovaCode.FormVarshamovaTest1(isTest); form.Show(); } else { SystematicCode.VarshamovaCode.FormVarshamovaTest2 form = new SystematicCode.VarshamovaCode.FormVarshamovaTest2(isTest); form.Show(); } } else if (formName.Equals("Коды Рида-Милеера")) { if (codec) { SystematicCode.Rida_MilleraCode.FormRida_MilleraTest1 form = new SystematicCode.Rida_MilleraCode.FormRida_MilleraTest1(isTest); form.Show(); } else { SystematicCode.Rida_MilleraCode.FormRida_MilleraTest2 form = new SystematicCode.Rida_MilleraCode.FormRida_MilleraTest2(isTest); form.Show(); } } else if (formName.Equals("Код Хеминга 1")) { SystematicCode.HemingaCode.FormHemingaTest1 form = new SystematicCode.HemingaCode.FormHemingaTest1(isTest, codec); form.Show(); } // cyclic codes else if (formName.Equals("Коды Абрамсона")) { CyclicCode.AbramsonaCode.FormAbramsTest1 form = new CyclicCode.AbramsonaCode.FormAbramsTest1(isTest, codec); form.Show(); } else if (formName.Equals("Коды Файра")) { FormFairaTest1 form = new FormFairaTest1(isTest, codec); form.Show(); } else if (formName.Equals("Код Хеминга 2")) { CyclicCode.HemingaCode.FormHemingaTest1 form = new CyclicCode.HemingaCode.FormHemingaTest1(isTest, codec); form.Show(); } else if (formName.Equals("Код БЧХ")) { CyclicCode.BChHCode.FormBChHTest1 form = new CyclicCode.BChHCode.FormBChHTest1(isTest, codec); form.Show(); } //non binary codes else if (formName.Equals("Первичные недвоичные коды")) { if (codec) { Non_binaryCode.PrimaryNon_binaryCode.FormPrimaryNon_binaryTest1 form = new Non_binaryCode.PrimaryNon_binaryCode.FormPrimaryNon_binaryTest1(isTest); form.Show(); } else { Non_binaryCode.PrimaryNon_binaryCode.FormPrimaryNon_binaryTest2 form = new Non_binaryCode.PrimaryNon_binaryCode.FormPrimaryNon_binaryTest2(isTest); form.Show(); } } else if (formName.Equals("Код с проверкой по модулю q")) { if (codec) { Non_binaryCode.CodeWithModuleTest.FormModuleTest1 form = new Non_binaryCode.CodeWithModuleTest.FormModuleTest1(isTest); form.Show(); } else { Non_binaryCode.CodeWithModuleTest.FormModuleTest6 form = new Non_binaryCode.CodeWithModuleTest.FormModuleTest6(isTest); form.Show(); } } else if (formName.Equals("Код с простым повторением")) { Non_binaryCode.CodeWithaSimpleIteration.FormIterationTest1 form = new Non_binaryCode.CodeWithaSimpleIteration.FormIterationTest1(isTest, codec); form.Show(); } else if (formName.Equals("Итеративный код")) { if (codec) { Non_binaryCode.IterativityCode.FormIterativityTest1 form = new Non_binaryCode.IterativityCode.FormIterativityTest1(isTest); form.Show(); } else { Non_binaryCode.IterativityCode.FormIterativityTest5 form = new Non_binaryCode.IterativityCode.FormIterativityTest5(isTest); form.Show(); } } //other codes else if (formName.Equals("Код Грея")) { ElseCodeAndLabs.GrayCode.FormGrayTest1 form = new ElseCodeAndLabs.GrayCode.FormGrayTest1(isTest, codec); form.Show(); } else if (formName.Equals("Двоично-десятичный код")) { FormDDCTest1 form = new FormDDCTest1(isTest, codec); form.Show(); } else if (formName.Equals("Код Бергера")) { ElseCodeAndLabs.BergerCode.FormBergerTest1 form = new ElseCodeAndLabs.BergerCode.FormBergerTest1(isTest, codec); form.Show(); } else if (formName.Equals("Код Шенона-Фано")) { ElseCodeAndLabs.Shenona_FanoCode.FormShenona_FanoTest1 form = new ElseCodeAndLabs.Shenona_FanoCode.FormShenona_FanoTest1(isTest); form.Show(); } else if (formName.Equals("Код Хаффмена")) { if (codec) { ElseCodeAndLabs.HaffmenaCode.FormHaffmenaTest1 form = new ElseCodeAndLabs.HaffmenaCode.FormHaffmenaTest1(isTest); form.Show(); } else { ElseCodeAndLabs.HaffmenaCode.FormHaffmenaTest2 form = new ElseCodeAndLabs.HaffmenaCode.FormHaffmenaTest2(isTest); form.Show(); } } else if (formName.Equals("Коды-спутники")) { if (codec) { ElseCodeAndLabs.SateliteCode.FormSateliteTest1 form = new ElseCodeAndLabs.SateliteCode.FormSateliteTest1(isTest); form.Show(); } else { ElseCodeAndLabs.SateliteCode.FormSateliteTest4 form = new ElseCodeAndLabs.SateliteCode.FormSateliteTest4(isTest); form.Show(); } } else if (formName.Equals("Количество информации и энтропия")) { ElseCodeAndLabs.Entropy.FormEntropyTest1 form = new ElseCodeAndLabs.Entropy.FormEntropyTest1(); form.Show(); } else if (formName.Equals("Рекурентный код")) { if (codec) { ElseCodeAndLabs.RekyrentCode.FormRekyrentTest1 form = new ElseCodeAndLabs.RekyrentCode.FormRekyrentTest1(isTest); form.Show(); } else { ElseCodeAndLabs.RekyrentCode.FormRekyrentTest4 form = new ElseCodeAndLabs.RekyrentCode.FormRekyrentTest4(isTest); form.Show(); } } else if (formName.Equals("Канальные коды")) { } }
private void button1_Click(object sender, EventArgs e) { string result = matrixTextBox1.Text + "," + matrixTextBox2.Text + "," + matrixTextBox3.Text + "," + matrixTextBox4.Text + "," + matrixTextBox5.Text + "," + matrixTextBox6.Text + "," + matrixTextBox7.Text + "," + matrixTextBox8.Text + "," + matrixTextBox9.Text + "," + matrixTextBox11.Text + "," + matrixTextBox12.Text + "," + matrixTextBox13.Text + "," + matrixTextBox14.Text + "," + matrixTextBox15.Text + "," + matrixTextBox16.Text + "," + matrixTextBox17.Text + "," + matrixTextBox18.Text + "," + matrixTextBox20.Text + "," + matrixTextBox21.Text + "," + matrixTextBox22.Text + "," + matrixTextBox23.Text + "," + matrixTextBox24.Text + "," + matrixTextBox25.Text + "," + matrixTextBox26.Text + "," + matrixTextBox28.Text + "," + matrixTextBox29.Text + "," + matrixTextBox30.Text + "," + matrixTextBox31.Text + "," + matrixTextBox32.Text + "," + matrixTextBox33.Text + "," + matrixTextBox35.Text + "," + matrixTextBox36.Text + "," + matrixTextBox37.Text + "," + matrixTextBox38.Text + "," + matrixTextBox39.Text + "," + matrixTextBox41.Text + "," + matrixTextBox42.Text + "," + matrixTextBox43.Text + "," + matrixTextBox44.Text + "," + matrixTextBox46.Text + "," + matrixTextBox47.Text + "," + matrixTextBox48.Text + "," + matrixTextBox50.Text + "," + matrixTextBox51.Text + "," + matrixTextBox53.Text; if (_isTest) { countPassedQuestion++; if (result == correctAnswer) { countCorrectAnswer++; } if (maxCount > countPassedQuestion) { FormHaffmenaTest1 form = new FormHaffmenaTest1(true); form.Show(); this.Close(); } else { FormHaffmenaTest2 form = new FormHaffmenaTest2(true, countCorrectAnswer); form.Show(); countPassedQuestion = 0; countCorrectAnswer = 0; this.Close(); } } else { FormHaffmenaTest1 form = new FormHaffmenaTest1(false); form.Show(); this.Close(); } }