Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.09 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Navigation;
  13. using System.Windows.Shapes;
  14. using ApproximationMethods;
  15.  
  16. namespace MCHASolution
  17. {
  18.     /// <summary>
  19.     /// Interaction logic for MainWindow.xaml
  20.     /// </summary>
  21.     public partial class MainWindow : Window
  22.     {
  23.         private SplineApproximation spline;
  24.         private LagrangeApproximation lagrange;
  25.         private NewtonApproximation newton;
  26.         private MinimalSquaresApproximation minSq;
  27.         public MainWindow()
  28.         {
  29.             InitializeComponent();
  30.             spline = new SplineApproximation();
  31.             lagrange = new LagrangeApproximation();
  32.             newton = new NewtonApproximation();
  33.             minSq = new MinimalSquaresApproximation();
  34.         }
  35.  
  36.         private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
  37.         {
  38.  
  39.         }
  40.  
  41.         private void addButton_Click(object sender, RoutedEventArgs e)
  42.         {
  43.             int i = tabControl.SelectedIndex;
  44.             double x, y;
  45.             switch (i)
  46.             {
  47.                 case 0:
  48.                     if (!double.TryParse(xL.Text, out x) || !double.TryParse(yL.Text, out y))
  49.                     {
  50.                         MessageBox.Show("Invalid Data", "Data Format Error");  
  51.                         return;
  52.                     }
  53.                     lagrange.Add(x,y);
  54.                     break;
  55.                 case 1:
  56.                     this.Title = "2";
  57.                     break;
  58.                 case 2:
  59.                     this.Title = "3";
  60.                     break;
  61.                 case 3:
  62.                     this.Title = "4";
  63.                     break;
  64.             }
  65.         }
  66.  
  67.         private void clearButton_Click(object sender, RoutedEventArgs e)
  68.         {
  69.             int i = tabControl.SelectedIndex;
  70.            
  71.            
  72.             switch (i)
  73.             {
  74.                 case 0:
  75.                    
  76.                     break;
  77.                 case 1:
  78.                     this.Title = "2";
  79.                     break;
  80.                 case 2:
  81.                     this.Title = "3";
  82.                     break;
  83.                 case 3:
  84.                     this.Title = "4";
  85.                     break;
  86.             }
  87.         }
  88.  
  89.         private void appButton_Click(object sender, RoutedEventArgs e)
  90.         {
  91.             int i = tabControl.SelectedIndex;
  92.             switch (i)
  93.             {
  94.                 case 0:
  95.                     appL.Content = lagrange.Polynom;
  96.                     break;
  97.                 case 1:
  98.                     this.Title = "2";
  99.                     break;
  100.                 case 2:
  101.                     this.Title = "3";
  102.                     break;
  103.                 case 3:
  104.                     this.Title = "4";
  105.                     break;
  106.             }
  107.         }
  108.  
  109.     }
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement