96 lines
2.5 KiB
C#
96 lines
2.5 KiB
C#
|
using System.Diagnostics;
|
|||
|
|
|||
|
namespace Lab5
|
|||
|
{
|
|||
|
public partial class Form1 : Form
|
|||
|
{
|
|||
|
public Controller service;
|
|||
|
public Alg1 Alg1;
|
|||
|
public Alg2 Alg2;
|
|||
|
public Stopwatch stopwatch;
|
|||
|
public int[,] matrixA;
|
|||
|
public int[,] matrixB;
|
|||
|
|
|||
|
public Form1()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
this.service = new Controller();
|
|||
|
this.Alg1 = new Alg1();
|
|||
|
this.Alg2 = new Alg2();
|
|||
|
this.stopwatch = new Stopwatch();
|
|||
|
}
|
|||
|
|
|||
|
private void buttonAlg1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
stopwatch.Start();
|
|||
|
int[,] matrixResult = Alg1.Begin(matrixA, matrixB);
|
|||
|
stopwatch.Stop();
|
|||
|
|
|||
|
labelResultTime.Text = "" + stopwatch.Elapsed;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
textBoxResult.Text = service.PrintResultMatrix(matrixResult);
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
MessageBox.Show(ex.Message, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
}
|
|||
|
stopwatch.Reset();
|
|||
|
}
|
|||
|
|
|||
|
private void buttonAlg2_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
stopwatch.Start();
|
|||
|
int[,] matrixResult = Alg2.Begin(matrixA, matrixB, (int)countStream.Value);
|
|||
|
stopwatch.Stop();
|
|||
|
|
|||
|
labelResultTime.Text = "" + stopwatch.Elapsed;
|
|||
|
|
|||
|
|
|||
|
textBoxResult.Text = service.PrintResultMatrix(matrixResult);
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
MessageBox.Show(ex.Message, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|||
|
}
|
|||
|
stopwatch.Reset();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private void buttonGenerateMatrix1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
matrixA = service.GenerateNewMatrix((int)genCountRowCol.Value);
|
|||
|
|
|||
|
|
|||
|
textBoxMatrix1.Text = service.PrintResultMatrix(matrixA);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void buttonGenerateMatrix2_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
matrixB = service.GenerateNewMatrix((int)genCountRowCol.Value);
|
|||
|
|
|||
|
|
|||
|
textBoxMatrix2.Text = service.PrintResultMatrix(matrixB);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
textBoxMatrix1.Text = "";
|
|||
|
textBoxMatrix2.Text = "";
|
|||
|
textBoxResult.Text = "";
|
|||
|
matrixA = null;
|
|||
|
matrixB = null;
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|