Inheritance: System.Windows.Forms.Form
Ejemplo n.º 1
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            try
            {
                var algorithmPlugin = SelectedAlgorithmPlugin;
                if (algorithmPlugin.HasAlgorithm(2))
                {
                    var f = new PartitioningParametersForm();
                    if (f.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }

                    var partitioningParameters = new PartitioningParameters(f.M1, f.M2);

                    var algorithm = algorithmPlugin.CreateAlgorithm(2, partitioningParameters);

                    if (algorithm == null)
                    {
                        return;
                    }

                    Test_result tr = new Test_result(fileStorage, fileStorage, algorithm, partitioningParameters);
                    tr.ShowDialog();
                }
            }
            catch { }
        }
Ejemplo n.º 2
0
        private void btnAlgorithm_Click(object sender, EventArgs e)
        {
            try
            {
                var algorithmPlugin = SelectedAlgorithmPlugin;
                if (algorithmPlugin.HasAlgorithm(2))
                {
                    var solutionVisualiserPlugin = SelectedSolutionVisualiserPlugin;

                    PartitioningParameters parameters = null;

                    if (SelectedSolutionMatrixData != null)
                    {
                        parameters = SelectedSolutionMatrixData.Data.Item1;
                    }
                    else if (SelectedMatrixData != null)
                    {
                        var f = new PartitioningParametersForm();
                        if (f.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        parameters = new PartitioningParameters(f.M1, f.M2);
                    }

                    var algorithm = algorithmPlugin.CreateAlgorithm(2, parameters);

                    if (algorithm == null)
                    {
                        return;
                    }

                    var matrix = SelectedMatrix;

                    var solution = algorithm.Run(matrix);

                    if (solutionVisualiserPlugin.HasSolutionVisualizer(2))
                    {
                        var solutionVisualiser = solutionVisualiserPlugin.CreateSolutionVisualizer(2);
                        solutionVisualiser.VisualizeSolution(matrix, solution);
                    }
                }
            }
            catch { }
        }