Beispiel #1
0
        private void loadButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.InitialDirectory = Directory.GetCurrentDirectory();
            dialog.RestoreDirectory = true;
            dialog.Filter           = "yml files (*.yml)|*.yml|All files (*.*)|*.*";
            if (dialog.ShowDialog() == true)
            {
                SolutionInput input = SolutionInput.FromFile(dialog.FileName);
                input.SetInput(parameters);

                if (input.IsFilterGrid)
                {
                    Dependencies.RemoveFilter(); // TODO reduce extra code?
                    FilterGrid filter = new FilterGrid(filterPanel);
                    filter.Set(input.FilterGrid);
                    filterBuilder = filter;
                }
                else
                {
                    Dependencies.RemoveFilter();
                    FilterFormulas filter = new FilterFormulas(filterPanel, Dependencies);
                    filter.Deserialize(input.FilterFormulas);
                    filterBuilder = filter;
                }
            }
        }
Beispiel #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Logger.Destination = log;
            RenderOptions.SetBitmapScalingMode(scopeImage, BitmapScalingMode.NearestNeighbor);

            RadioButton[] filterModeButtons = { matrixRadioButton, formulaRadioButton };
            FilterModeGroup          = new RadioButtonGroup(filterModeButtons);
            FilterModeGroup.Changed += FillModeChanged;

            RadioButton[] solMethodButtons = { explicitRadioButton, implicitRadioButton };
            SolutionMethodGroup          = new RadioButtonGroup(solMethodButtons);
            SolutionMethodGroup.Changed += SolutionMethodChanged;

            Dependencies = new DependencySpace();
            AddParam("D", "D");
            AddParam("A_0", "A0");
            AddParam("K", "K");
            AddParam("T", "T");
            AddParam("t_count", "time");
            AddParam("x_count", "spatial");
            AddParam("u_0", "u0(x)");
            AddLabel("");
            AddParam("v", "v(x, t)");
            AddButton("Draw v(x,t)", (a, b) => DrawExpectedSolution());
            SolutionInput defaultInput = new SolutionInput();

            defaultInput.SetInput(parameters);

            if (defaultInput.IsFilterGrid)
            {
                FilterGrid filterGrid = new FilterGrid(filterPanel);
                filterGrid.Set(defaultInput.FilterGrid);
                filterBuilder = filterGrid;
            }
            else
            {
                FilterFormulas filterFormulas = new FilterFormulas(filterPanel, Dependencies);
                filterFormulas.Deserialize(defaultInput.FilterFormulas);
                filterBuilder = filterFormulas;
            }
        }