コード例 #1
0
        public MainForm()
        {
            BuildLayout();

            Controls.Add(functionsList);
            Controls.Add(functionView);
            Controls.Add(parametersView);
            Controls.Add(actions);

            InitializeComponent();


            functionsList.SelectedFunctionChanged += name => SelectedFunctionChanged.Invoke(name);
            var resetButton = actions.Controls["Reset"];

            resetButton.Click += (sender, args) => ResetButtonClicked.Invoke(functionsList.CurrentSelection());

            var saveButton = actions.Controls["Save"];

            saveButton.Click +=
                (sender, args) =>
            {
                var nameGetter = new NameGetterForm();
                nameGetter.Controls["okButton"].Click += (o, eventArgs) =>
                {
                    var newName = nameGetter.Controls.OfType <TextBox>().First().Text;
                    SaveButtonClicked.Invoke(functionsList.CurrentSelection(), newName,
                                             parametersView.GetCoefficients());
                    nameGetter.Close();
                };
                nameGetter.ShowDialog(this);
            };

            var openButton = actions.Controls["Open"];

            openButton.Click += (sender, args) => { if (OpenCurrent != null)
                                                    {
                                                        OpenCurrent.Invoke(sender, args);
                                                    }
            };

            parametersView.ParameterUpDownsChanged +=
                downs => { if (ParameterUpDownsChanged != null)
                           {
                               ParameterUpDownsChanged.Invoke(downs);
                           }
            };
        }
コード例 #2
0
 private void btnReset_Click(object sender, RoutedEventArgs e)
 {
     VisualState = State.Idle;
     ResetButtonClicked?.Invoke(this, EventArgs.Empty);
 }