private void button1_Click(object sender, EventArgs e) { InitialiseParams(); ImageLoader loader = new ImageLoader(); Bitmap bits = loader.LoadPicture(pathIn); if (bits == null) { LoadingFailed("Неверный путь к исходному файлу!"); return; } Binarisator binarisator = new Binarisator(bits, lev); Bitmap outBits; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); if (radioButton1.Checked) outBits = binarisator.Binarisation(); else if (radioButton2.Checked) outBits = binarisator.DoubleBinarisation(); else if (radioButton3.Checked) outBits = binarisator.Sobel(); else outBits = binarisator.Laplas(); stopWatch.Stop(); string errorMessage = loader.Save(outBits, pathOut); if (! String.IsNullOrEmpty(errorMessage)) { LoadingFailed(errorMessage); return; } label4.Text = "Программа отработала успешно! Время " + stopWatch.Elapsed; }