private void APResult_Click(object sender, RoutedEventArgs e) { try { if (double.TryParse(AP1.Text, out tryParse) && double.TryParse(AP2.Text, out tryParse) && double.TryParse(AP3.Text, out tryParse)) { if (APSelection.SelectedIndex == 0) { OutAP.Text = _mathFunctions.APSum(System.Convert.ToDouble(AP1.Text), System.Convert.ToDouble(AP2.Text), System.Convert.ToDouble(AP3.Text)).ToString(); } else if (APSelection.SelectedIndex == 1) { OutAP.Text = _mathFunctions.APDiff(System.Convert.ToDouble(AP1.Text), System.Convert.ToDouble(AP2.Text), System.Convert.ToDouble(AP3.Text)).ToString(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }