Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.57 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.IO;
  11. using System.Diagnostics;
  12.  
  13. namespace Proigral
  14. {
  15. public partial class Form1 : Form
  16. {
  17. public bool track_box_hide = true;
  18. public bool video_hide = true;
  19. public int video_go_back = 0;
  20.  
  21. public Form1()
  22. {
  23. InitializeComponent();
  24.  
  25.  
  26. }
  27.  
  28. private void play_btn_Click(object sender, EventArgs e)
  29. {
  30.  
  31. }
  32.  
  33. private void pause_btn_Click(object sender, EventArgs e)
  34. {
  35.  
  36. }
  37.  
  38. private void forward_btn_Click(object sender, EventArgs e)
  39. {
  40. try
  41. {
  42. if (track_box.SelectedIndex >= 0)
  43. {
  44. int select = track_box.SelectedIndex;
  45. track_box.SelectedIndex = select + 1;
  46. }
  47. }
  48. catch (ArgumentOutOfRangeException) { }
  49. }
  50.  
  51. private void back_btn_Click(object sender, EventArgs e)
  52. {
  53. try
  54. {
  55. if (track_box.SelectedIndex > 0)
  56. {
  57. int select = track_box.SelectedIndex;
  58. track_box.SelectedIndex = select - 1;
  59. }
  60. }
  61. catch (ArgumentOutOfRangeException) { }
  62. }
  63.  
  64. private void stop_btn_Click(object sender, EventArgs e)
  65. {
  66.  
  67. }
  68. string[] files, paths;
  69. private void choose_track_btn_Click(object sender, EventArgs e)
  70. {
  71. if (OpenMP3MP4FileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  72. {
  73. files = OpenMP3MP4FileDialog.SafeFileNames;
  74. paths = OpenMP3MP4FileDialog.FileNames;
  75. for (int i = 0; i < files.Length; i++)
  76. {
  77. track_box.Items.Add(files[i]);
  78. }
  79. }
  80. }
  81.  
  82. private void delete_track_Click(object sender, EventArgs e)
  83. {
  84. try
  85. {
  86. if (track_box.SelectedIndex >= 0)
  87. {
  88. int select = track_box.SelectedIndex;
  89. track_box.Items.RemoveAt(track_box.SelectedIndex);
  90. track_box.SelectedIndex = select - 1;
  91. }
  92. }
  93. catch (IndexOutOfRangeException) { }
  94. }
  95.  
  96. private void save_tracklist_Click(object sender, EventArgs e)
  97. {
  98. try
  99. {
  100. if (track_box.Items.Count > 0)
  101. {
  102. using (TextWriter TW = new StreamWriter("list.txt"))
  103. {
  104. foreach (string itemText in track_box.Items)
  105. {
  106. TW.WriteLine(itemText);
  107. }
  108. }
  109. }
  110. }
  111. catch (Exception) { }
  112. }
  113.  
  114. private void clear_trackbox_Click(object sender, EventArgs e)
  115. {
  116. track_box.Items.Clear();
  117. }
  118.  
  119. private void open_tracklist_Click(object sender, EventArgs e)
  120. {
  121. int index;
  122. string line;
  123. if (OpenTXTFileDialog.ShowDialog() == DialogResult.OK)
  124. {
  125. //здесь происходит удаление имеющихся записей в listBox1
  126. if (track_box.Items.Count != 0)
  127. for (index = track_box.Items.Count - 1; index >= 0; index--)
  128. track_box.Items.RemoveAt(index);
  129.  
  130. string fileName = OpenTXTFileDialog.FileName;
  131. FileStream sss = File.Open(fileName, FileMode.Open, FileAccess.Read);
  132. if (sss != null)
  133. {
  134. StreamReader reader = new StreamReader(sss);
  135. while ((line = reader.ReadLine()) != null)
  136. track_box.Items.Add(line);
  137. sss.Close();
  138. }
  139. }
  140. }
  141.  
  142. private void track_list_btn_Click(object sender, EventArgs e)
  143. {
  144.  
  145. if (this.Height == 780 | this.Height == 505)
  146. {
  147. track_box_hide = true;
  148. }
  149. else
  150. {
  151. track_box_hide = false;
  152. }
  153. if (track_box_hide)
  154. {
  155. track_box.Visible = false;
  156. this.Height -= 230;
  157. video_btn.Top = video_go_back;
  158. video_btn.Top = track_box.Top + 5;
  159. video.Top = video_btn.Top + 32;
  160. }
  161. if (!track_box_hide)
  162. {
  163. track_box.Visible = true;
  164. this.Height += 400;
  165. video_btn.Top = 438;
  166. video.Top = video_btn.Top + 32;
  167. }
  168. }
  169.  
  170. private void video_btn_Click(object sender, EventArgs e)
  171. {
  172. if (this.Height == 780)
  173. {
  174. video_hide = true;
  175. }
  176. else
  177. {
  178. video_hide = false;
  179. }
  180. if (video_hide)
  181. {
  182. video.Visible = false;
  183. this.Height -= 275;
  184. }
  185. if (!video_hide)
  186. {
  187. video.Visible = true;
  188. this.Height += 275;
  189. }
  190. }
  191. }
  192. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement