Exemplo n.º 1
0
        /// <summary>
        /// CalculateButtonClick Method occurs when the draw button is pressed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DrawButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                if (TextBoxes.All(t => t.TextBox.Text != ""))
                {
                    N  = int.Parse(TextBoxes[0].TextBox.Text);
                    X0 = int.Parse(TextBoxes[1].TextBox.Text);
                    ExtractEquation();

                    if (Diagram != null && Diagram.Polyline != null)
                    {
                        Diagram.Polyline.Points = null;
                        SinusDiagram            = null;
                        DrawSinusDiagram();
                    }
                    Diagram = new Diagram(ScrollViewers[0].Grid, Equation, EquationType.TaylorSeries,
                                          int.Parse(TextBoxes[0].TextBox.Text), int.Parse(TextBoxes[1].TextBox.Text),
                                          SinusDiagram);

                    ScrollViewers[0].ScrollViewer.Content = ScrollViewers[0].Grid;
                }
            }
            catch (Exception exception) { MessageBox.Show(exception.Message); TextBoxes.All(t => t.TextBox.Text == ""); }
        }
Exemplo n.º 2
0
 /// <summary>
 /// DrawButtonClick Method occurs when the draw button is pressed
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DrawButtonClick(object sender, RoutedEventArgs e)
 {
     try
     {
         if (TextBoxes[0].TextBox.Text != "")
         {
             if (Diagram != null && Diagram.Polyline != null)
             {
                 Diagram.Polyline.Points = null;
             }
             Diagram = new Diagram(ScrollViewers[0].Grid, TextBoxes[0].TextBox.Text, EquationType.Normal);
             ScrollViewers[0].ScrollViewer.Content = ScrollViewers[0].Grid;
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
         TextBoxes.All(t => t.TextBox.Text == "");
     }
 }