Advertisement
Guest User

Untitled

a guest
May 27th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.09 KB | None | 0 0
  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. using System.Diagnostics;
  11. using System.IO;
  12. using System.Threading;
  13. using System.Runtime.InteropServices;
  14.  
  15. namespace ComputerController
  16. {
  17. public partial class Form1 : Form
  18. {
  19.  
  20. public Form1()
  21. {
  22. InitializeComponent();
  23. MaximumSize = new Size(521, 360);
  24. MinimumSize = new Size(521, 360);
  25. }
  26.  
  27. private void Form1_Load(object sender, EventArgs e)
  28. {
  29.  
  30. }
  31.  
  32. private void button1_Click(object sender, EventArgs e)
  33. {
  34. Process.Start("shutdown", "/s /t 0");
  35. }
  36.  
  37. private void button2_Click(object sender, EventArgs e)
  38. {
  39. Process.Start("shutdown", "/r /t 0");
  40. }
  41.  
  42. private void button3_Click(object sender, EventArgs e)
  43. {
  44. //textBox1 - X textBox2 - Y
  45. curpos(int.Parse(textBox1.Text), int.Parse(textBox2.Text));
  46. }
  47.  
  48. private void button4_Click(object sender, EventArgs e)
  49. {
  50. MessageBox.Show(richTextBox1.Text);
  51. }
  52.  
  53. private void richTextBox2_TextChanged(object sender, EventArgs e)
  54. {
  55.  
  56. }
  57.  
  58. private void button5_Click(object sender, EventArgs e)
  59. {
  60. timer1.Stop();
  61. }
  62.  
  63. int i = 0;
  64. private void timer1_Tick(object sender, EventArgs e)
  65. {
  66. textBox3.Text = Convert.ToString(i);
  67. i++;
  68. }
  69.  
  70. private void button6_Click(object sender, EventArgs e)
  71. {
  72. timer1.Enabled = true;
  73. timer1.Start();
  74. }
  75.  
  76. private void button7_Click(object sender, EventArgs e)
  77. {
  78. timer1.Stop();
  79. i = 0;
  80. textBox3.Text = "";
  81. }
  82.  
  83. private void button8_Click(object sender, EventArgs e)
  84. {
  85. wyszukaj(textBox4.Text);
  86. }
  87.  
  88. private void textBox4_TextChanged(object sender, EventArgs e)
  89. {
  90.  
  91. }
  92.  
  93. private void wyszukaj(string w)
  94. {
  95. Process.Start("http://google.pl/search?q=" + w);
  96. }
  97.  
  98. private void button9_Click(object sender, EventArgs e)
  99. {
  100. double wyn;
  101. switch (listBox1.SelectedIndex)
  102. {
  103. case 0:
  104. wyn = (double.Parse(textBox5.Text) + double.Parse(textBox6.Text));
  105. MessageBox.Show(wyn.ToString());
  106. break;
  107. case 1:
  108. wyn = (double.Parse(textBox5.Text) - double.Parse(textBox6.Text));
  109. MessageBox.Show(wyn.ToString());
  110. break;
  111. case 2:
  112. wyn = (double.Parse(textBox5.Text) * double.Parse(textBox6.Text));
  113. MessageBox.Show(wyn.ToString());
  114. break;
  115. case 3:
  116. wyn = (double.Parse(textBox5.Text) / double.Parse(textBox6.Text));
  117. MessageBox.Show(wyn.ToString());
  118. break;
  119. case 4:
  120. wyn = Math.Pow(double.Parse(textBox5.Text), double.Parse(textBox6.Text));
  121. MessageBox.Show(wyn.ToString());
  122. break;
  123. case 5:
  124. wyn = pierwiastek(double.Parse(textBox5.Text), double.Parse(textBox6.Text));
  125. MessageBox.Show(wyn.ToString());
  126. break;
  127. case 6:
  128. wyn = Math.Log(double.Parse(textBox6.Text), double.Parse(textBox5.Text));
  129. MessageBox.Show(wyn.ToString());
  130. break;
  131. case 7:
  132. wyn = silnia(int.Parse(textBox5.Text));
  133. MessageBox.Show(wyn.ToString());
  134. break;
  135. }
  136. }
  137. private double pierwiastek(double x, double y)
  138. {
  139. return Math.Pow(x, (1 / y));
  140. }
  141.  
  142. private int silnia(int x)
  143. {
  144. for (int i = x - 1; i > 1; --i) x = x * i;
  145. return x;
  146. }
  147.  
  148. private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
  149. {
  150. if (listBox1.SelectedIndex == 7) { textBox6.Hide(); label5.Hide(); }
  151. else{ textBox6.Show(); label5.Show(); }
  152. }
  153.  
  154. private void button10_Click_1(object sender, EventArgs e)
  155. {
  156. if (checkBox1.Checked == true) File.Delete(@"" + textBox7.Text);
  157. }
  158.  
  159. private void groupBox7_Enter(object sender, EventArgs e)
  160. {
  161.  
  162. }
  163. private void curpos(int x, int y)
  164. {
  165. Cursor.Position = new Point(x, y);
  166. }
  167.  
  168. private void label4_Click(object sender, EventArgs e)
  169. {
  170.  
  171. }
  172.  
  173. private void button11_Click(object sender, EventArgs e)
  174. {
  175. Process.Start("https://pastebin.com/");
  176. }
  177. }
  178. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement