Form1.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace _07_1_Delegacje
  11. {
  12. public partial class Form1 : Form
  13. {
  14. Robocza r = new Robocza();
  15. p1 ppp;
  16. funS fff;
  17. public Form1()
  18. {
  19. InitializeComponent();
  20. }
  21. private void button1_Click(object sender, EventArgs e)
  22. {
  23. ppp = r.ProxX;
  24. }
  25. private void button2_Click(object sender, EventArgs e)
  26. {
  27. ppp = r.ProxY;
  28. }
  29. private void button3_Click(object sender, EventArgs e)
  30. {
  31. ppp = Robocza.ProxZ;
  32. }
  33. private void button4_Click(object sender, EventArgs e)
  34. {
  35. if (ppp != null)
  36. ppp();
  37. else
  38. MessageBox.Show("ppp jest null'em!");
  39. }
  40. private void button5_Click(object sender, EventArgs e)
  41. {
  42. ppp?.Invoke();
  43. }
  44. private void button8_Click(object sender, EventArgs e)
  45. {
  46. ppp = new p1(r.ProxX);
  47. }
  48. private void button7_Click(object sender, EventArgs e)
  49. {
  50. ppp = new p1(r.ProxY);
  51. }
  52. private void button6_Click(object sender, EventArgs e)
  53. {
  54. ppp = new p1(Robocza.ProxZ);
  55. }
  56. private void button11_Click(object sender, EventArgs e)
  57. {
  58. ppp += r.ProxX;
  59. }
  60. private void button10_Click(object sender, EventArgs e)
  61. {
  62. ppp += r.ProxY;
  63. }
  64. private void button9_Click(object sender, EventArgs e)
  65. {
  66. ppp += Robocza.ProxZ;
  67. }
  68. private void button14_Click(object sender, EventArgs e)
  69. {
  70. ppp -= r.ProxX;
  71. }
  72. private void button13_Click(object sender, EventArgs e)
  73. {
  74. ppp -= r.ProxY;
  75. }
  76. private void button12_Click(object sender, EventArgs e)
  77. {
  78. ppp -= Robocza.ProxZ;
  79. }
  80. Random rnd = new Random((int)DateTime.Now.Ticks);
  81. private void button15_Click(object sender, EventArgs e)
  82. {
  83. if (rnd.NextDouble() < 0.5)
  84. fff = r.fs1;
  85. else
  86. fff = r.fs2;
  87. }
  88. private void button17_Click(object sender, EventArgs e)
  89. {
  90. if (rnd.NextDouble() < 0.5)
  91. fff += r.fs1;
  92. else
  93. fff += r.fs2;
  94. }
  95. private void button16_Click(object sender, EventArgs e)
  96. {
  97. int i = rnd.Next(1000);
  98. double d = rnd.NextDouble() * 100;
  99. DateTime t = new DateTime(2024, 4, rnd.Next(31));
  100. string s = $"Ala ma kota ({new DateTime(rnd.Next(2000000000))})";
  101. label1.Text = fff?.Invoke(i, d, t, s );
  102. }
  103. }
  104. }