Beispiel #1
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (saveFileDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             FileTls fileTls = new FileTls(saveFileDialog.FileName);
             fileTls.WriteString(Output.Text);
         }
         catch (Exception eror)
         {
             MessageBox.Show(eror.Message, "ошибка");
         }
     }
 }
Beispiel #2
0
 private void save_Click(object sender, EventArgs e)
 {
     if (saveFileDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             FileTls fileTls = new FileTls(saveFileDialog.FileName);
             fileTls.WriteArr(DataGridViewUtils.GridToArray <int>(OutputGrid));
         }
         catch (Exception eror)
         {
             MessageBox.Show(eror.Message, "ошибка");
         }
     }
 }
Beispiel #3
0
 private void open_Click(object sender, EventArgs e)
 {
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             FileTls fileTls = new FileTls(openFileDialog.FileName);
             bool[,] Matrix = fileTls.ReadBoolMatrix();
             DataGridViewUtils.Array2ToGrid(Grid, Matrix);
         }
         catch (Exception eror)
         {
             MessageBox.Show(eror.Message, "ошибка");
         }
     }
 }
Beispiel #4
0
 private static void ArrFile(int[] Arr)
 {
     while (true)
     {
         try
         {
             Console.Write("введите имя файла: ");
             FileTls fileTls = new FileTls(Console.ReadLine());
             fileTls.WriteArr(Arr);
             return;
         }
         catch (Exception eror)
         {
             Console.WriteLine(eror.Message);
         }
     }
 }
Beispiel #5
0
 private static bool[,] BoolMatrixFile()
 {
     while (true)
     {
         try
         {
             Console.Write("введите имя файла: ");
             FileTls fileTls = new FileTls(Console.ReadLine());
             bool[,] Matrix = fileTls.ReadBoolMatrix();
             return(Matrix);
         }
         catch (Exception eror)
         {
             Console.WriteLine(eror.Message);
         }
     }
 }
Beispiel #6
0
 private static int[,] IntMatrixFile()
 {
     while (true)
     {
         try
         {
             Console.Write("введите имя файла: ");
             FileTls fileTls = new FileTls(Console.ReadLine());
             int[,] Matrix = fileTls.ReadIntMatrix();
             if (Matrix.GetLength(0) != Matrix.GetLength(1))
             {
                 throw new Exception("матрица не квадратная");
             }
             return(Matrix);
         }
         catch (Exception eror)
         {
             Console.WriteLine(eror.Message);
         }
     }
 }
Beispiel #7
0
 private void open_Click(object sender, EventArgs e)
 {
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             FileTls fileTls = new FileTls(openFileDialog.FileName);
             int[,] Matrix = fileTls.ReadIntMatrix();
             if (Matrix.GetLength(0) == Matrix.GetLength(0))
             {
                 DataGridViewUtils.Array2ToGrid(InputGrid, Matrix);
             }
             else
             {
                 throw new Exception("матрица должна быть квадратной");
             }
         }
         catch (Exception eror)
         {
             MessageBox.Show(eror.Message, "ошибка");
         }
     }
 }