public MainWindow() { plot = new PlotGenerator(); plot.Compile(); double x = Math.Sin(1.0); this.DataContext = this; InitializeComponent(); StartValueTextBox.DataContext = plot.StartValueFunction; EndValueTextBox.DataContext = plot.EndValueFunction; AddFunctionButton.Click += new RoutedEventHandler(AddFunctionButton_Click); UpdateButton.Click += new RoutedEventHandler(UpdateButton_Click); }
void UpdateButton_Click(object sender, RoutedEventArgs e) { try { plot.Compile(); PlotDisplay.UpdatePlot(); } catch (Exception ex) { ErrorDialog dialog = new ErrorDialog("Expression Compilation Error", ex.ToString()) { Owner = Window.GetWindow(this) }; dialog.ShowDialog(); } }