コード例 #1
0
        private void forwardItem_Click(object sender, EventArgs e)
        {
            if (FormatFactory.PatternRequired(FormatFactory.FormatsDictionary[formatBox.Text]))
            {
                if (patternForm == null || patternForm.IsDisposed)
                {
                    patternForm = new PatternForm();
                }

                patternForm.Owner = this;
                patternForm.Show();
                patternForm.Update(formatBox.Text);
                Hide();
            }
            else
            {
                IMatrix A;
                IVector x0, b;
                constructorForm = (ConstructorForm)Owner;
                constructorForm.GetSLAE(out A, formatBox.Text, out b, out x0);

                mainForm.SetSLAE(A, b, x0);
                mainForm.Show();
                Hide();
            }
        }
コード例 #2
0
ファイル: PatternForm.cs プロジェクト: alandre/SLAE-solver
        private void forwardToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            bool symmetric = SLAESource.IsSymmetric;
            var  tmp       = new FormatFactory();

            if (symmetric)
            {
                matrix = FormatFactory.Convert((SymmetricCoordinationalMatrix)MatrixVisualRepresentation.PatternedGridViewToCoordinational(A, symmetric),
                                               FormatFactory.FormatsDictionary[format]);
            }
            else
            {
                matrix = FormatFactory.Convert((CoordinationalMatrix)MatrixVisualRepresentation.PatternedGridViewToCoordinational(A, symmetric),
                                               FormatFactory.FormatsDictionary[format]);
            }

            if (patternChanged)
            {
                CoordinationalMatrix user = (CoordinationalMatrix)MatrixVisualRepresentation.PatternedGridViewToCoordinational(A, symmetric);
                CoordinationalMatrix auto = matrix.ConvertToCoordinationalMatrix();

                foreach (var elem in auto)
                {
                    if (!user.Contains((elem.value, elem.row, elem.col)))
                    {
                        var res = MessageBox.Show("Заданный портрет не соответствует выбранному формату хранения. Портрет будет автоматически преобразован к корректному виду.", "Уведомление", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                        if (res == DialogResult.OK)
                        {
                            mainForm.SetSLAE(matrix, b, x0);
                            Close();
                        }
                        return;
                    }
                }
            }

            mainForm.SetSLAE(matrix, b, x0);
            Close();
        }