Ejemplo n.º 1
0
        /// <summary>
        /// Обработчик нажатия кнопки "Сохранить"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void saveToolStripButton_Click(object sender, EventArgs e)
        {
            saveFileDialog1.InitialDirectory = "C:\\";
            saveFileDialog1.Filter           = "CA files (*.ca)|*.ca";
            saveFileDialog1.FilterIndex      = 1;
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    SaLo.SaveData(saveFileDialog1.FileName, r_surv, r_born, Cells, config);
                }
                catch
                {
                    MessageBox.Show("Error: Could not read file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Обработчик нажатия кнопки "Открыть файл"
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void openToolStripButton_Click(object sender, EventArgs e)
 {
     openFileDialog1.InitialDirectory = "C:\\";
     openFileDialog1.Filter           = "CA files (*.ca)|*.ca";
     openFileDialog1.FilterIndex      = 1;
     openFileDialog1.FileName         = "";
     openFileDialog1.RestoreDirectory = true;
     if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         try
         {
             if (openFileDialog1.OpenFile() != null)
             {
                 SaLo.LoadData(openFileDialog1.FileName, r_surv, r_born, Cells, ref config);
             }
         }
         catch
         {
             MessageBox.Show("Error: Could not read file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     SetArrayOfRules();
     paint(Cells);
 }