qdrow

Untitled

Sep 20th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. /// <summary>
  2. /// Логика взаимодействия для MainWindow.xaml
  3. /// </summary>
  4. public partial class MainWindow : Window
  5. {
  6. public bool comma = false;
  7. public MainWindow()
  8. {
  9. InitializeComponent();
  10. }
  11.  
  12. private void Numbers(object sender, RoutedEventArgs e)
  13. {
  14. Button Any_but = (Button)sender;
  15. switch (Any_but.Content)
  16. {
  17. case "0":
  18. if (Tablo.Text != "0")
  19. {
  20. Tablo.Text += "0";
  21. }
  22. break;
  23. default:
  24. if (Tablo.Text == "0")
  25. {
  26. Tablo.Text = Convert.ToString(Any_but.Content);
  27. }
  28. else
  29. {
  30. Tablo.Text += Any_but.Content;
  31. }
  32. break;
  33. }
  34. }
  35. private void Comma_Click(object sender, RoutedEventArgs e)
  36. {
  37. if (!comma)
  38. {
  39. comma = true;
  40. Tablo.Text += ",";
  41. }
  42. }
  43. private void Cancel_mode(object sender, RoutedEventArgs e)
  44. {
  45. Button cancel = (Button)sender;
  46. switch (cancel.Content)
  47. {
  48. case "CE":
  49. Tablo.Text = "0";
  50. break;
  51. case "C":
  52. Tablo.Text = "0";
  53. Func_calc.Text = "";
  54. break;
  55. default:
  56. if (Tablo.Text.Length != 1)
  57. {
  58. Tablo.Text = Tablo.Text.Substring(0, Tablo.Text.Length - 1);
  59. }
  60. else
  61. {
  62. Tablo.Text = "0";
  63. }
  64. break;
  65. }
  66.  
  67.  
  68. }
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment