예제 #1
0
        private void fileInput_Click(object sender, EventArgs e)
        {
            try
            {
                var file = new OpenFileDialog();
                file.Filter = "Text file|*.txt";
                if (file.ShowDialog() == DialogResult.OK)
                {
                    StreamReader sr        = new StreamReader(file.FileName);
                    string       dataInput = sr.ReadToEnd();
                    sr.Close();

                    Input           = MatrixInitialazer.Input(dataInput, Input, sim.Checked);
                    epsBox.Enabled  = true;
                    iterBox.Enabled = true;
                    var tmp   = new FormatFactory();
                    var value = tmp.formats[formatBox.SelectedItem.ToString()];
                    fileInputedSLAE.matrix = FormatFactory.Init(value, Input, Input.symmetry);
                    var a = FormatFactory.PatternRequired(formatBox.SelectedItem.ToString());

                    fileInputBtn.Text = file.FileName;
                    fileInputNotNull  = true;
                    CheckedChanged(inputCheckedImg, inputChecked = true);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Неправильный формат входного файла.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void fileInput_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog file = new OpenFileDialog();
                file.Filter = "Text file|*.txt";
                if (file.ShowDialog() == DialogResult.OK)
                {
                    StreamReader sr        = new StreamReader(file.FileName);
                    string       dataInput = sr.ReadToEnd();
                    sr.Close();

                    Input           = MatrixInitialazer.Input(dataInput, Input, sim.Checked);
                    epsBox.Enabled  = true;
                    timeBox.Enabled = true;
                    matrix          = FormatFactory.Init((Formats)formatBox.SelectedIndex, Input, Input.symmetry);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Неправильный формат входного файла.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }