Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 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.Windows.Forms;
  9.  
  10. namespace LockSaver
  11. {
  12.  
  13. public partial class Form_Saver : Form
  14. {
  15. private int _check1 = 0;
  16. private int _check2 = 0;
  17. private int _check3 = 0;
  18. private string[] _tastenkombination;
  19. private string[] _filePath;
  20. private int _itemCount;
  21. private int zaehler = 0;
  22. private int _time;
  23.  
  24. public Form_Saver(string[] _newTastenkombination, int _arrayLaenge, string[] _newFilePath, int _newItemCount, int _newTime)
  25. {
  26. InitializeComponent();
  27. _tastenkombination = new string[_arrayLaenge];
  28. _tastenkombination = _newTastenkombination;
  29. _filePath = _newFilePath;
  30. _itemCount = _newItemCount;
  31. _time = _newTime;
  32. //Keys k = (Keys)Enum.Parse(typeof(Keys), _tastenkombination[0]);
  33. //MessageBox.Show(Convert.ToString(k));
  34. }
  35.  
  36. private void Form_Saver_Load(object sender, EventArgs e)
  37. {
  38. FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
  39. this.Bounds = Screen.PrimaryScreen.Bounds;
  40. Cursor.Hide();
  41. TopMost = true;
  42. timerNaechstesBild.Interval = _time*1000;
  43. timerNaechstesBild.Start();
  44. pictureBoxSaver.Bounds = Screen.PrimaryScreen.Bounds;
  45. pictureBoxSaver.SizeMode = PictureBoxSizeMode.StretchImage;
  46. pictureBoxSaver.Image = Image.FromFile(_filePath[zaehler]);
  47. pictureBoxSaver.SizeMode = PictureBoxSizeMode.StretchImage;
  48. zaehler++;
  49. }
  50.  
  51. private void Form_Saver_KeyDown(object sender, KeyEventArgs e)
  52. {
  53. if (e.KeyCode == Keys.A)
  54. {
  55. timerInterrupt.Start();
  56. _check1 = 1;
  57. }
  58. if (e.KeyCode == Keys.S)
  59. {
  60. timerInterrupt.Start();
  61. _check2 = 1;
  62. }
  63. if (e.KeyCode == Keys.D)
  64. {
  65. timerInterrupt.Start();
  66. _check3 = 1;
  67. }
  68.  
  69. if (e.KeyCode == Keys.RWin)
  70. {
  71. e.Handled = true;
  72. }
  73.  
  74. }
  75.  
  76. private void timerInterrupt_Tick(object sender, EventArgs e)
  77. {
  78. if (_check1 == 1 && _check2 == 1 && _check3 == 1)
  79. {
  80. this.Close();
  81. Cursor.Show();
  82. Form_Start.ActiveForm.TopMost = true;
  83. timerInterrupt.Stop();
  84. timerNaechstesBild.Stop();
  85. }
  86.  
  87. _check1 = 0;
  88. _check2 = 0;
  89. _check3 = 0;
  90.  
  91. }
  92.  
  93. private void timerNaechstesBild_Tick(object sender, EventArgs e)
  94. {
  95. try
  96. {
  97. pictureBoxSaver.Image = Image.FromFile(_filePath[zaehler]);
  98. pictureBoxSaver.SizeMode = PictureBoxSizeMode.StretchImage;
  99. zaehler++;
  100.  
  101. if (zaehler == _itemCount)
  102. {
  103. zaehler = 0;
  104. }
  105. }
  106. catch
  107. {
  108. zaehler++;
  109. }
  110. }
  111.  
  112. }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement