Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.IO;
- using System.Diagnostics;
- namespace Proigral
- {
- public partial class Form1 : Form
- {
- public bool track_box_hide = true;
- public bool video_hide = true;
- public int video_go_back = 0;
- public Form1()
- {
- InitializeComponent();
- }
- private void play_btn_Click(object sender, EventArgs e)
- {
- }
- private void pause_btn_Click(object sender, EventArgs e)
- {
- }
- private void forward_btn_Click(object sender, EventArgs e)
- {
- try
- {
- if (track_box.SelectedIndex >= 0)
- {
- int select = track_box.SelectedIndex;
- track_box.SelectedIndex = select + 1;
- }
- }
- catch (ArgumentOutOfRangeException) { }
- }
- private void back_btn_Click(object sender, EventArgs e)
- {
- try
- {
- if (track_box.SelectedIndex > 0)
- {
- int select = track_box.SelectedIndex;
- track_box.SelectedIndex = select - 1;
- }
- }
- catch (ArgumentOutOfRangeException) { }
- }
- private void stop_btn_Click(object sender, EventArgs e)
- {
- }
- string[] files, paths;
- private void choose_track_btn_Click(object sender, EventArgs e)
- {
- if (OpenMP3MP4FileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- files = OpenMP3MP4FileDialog.SafeFileNames;
- paths = OpenMP3MP4FileDialog.FileNames;
- for (int i = 0; i < files.Length; i++)
- {
- track_box.Items.Add(files[i]);
- }
- }
- }
- private void delete_track_Click(object sender, EventArgs e)
- {
- try
- {
- if (track_box.SelectedIndex >= 0)
- {
- int select = track_box.SelectedIndex;
- track_box.Items.RemoveAt(track_box.SelectedIndex);
- track_box.SelectedIndex = select - 1;
- }
- }
- catch (IndexOutOfRangeException) { }
- }
- private void save_tracklist_Click(object sender, EventArgs e)
- {
- try
- {
- if (track_box.Items.Count > 0)
- {
- using (TextWriter TW = new StreamWriter("list.txt"))
- {
- foreach (string itemText in track_box.Items)
- {
- TW.WriteLine(itemText);
- }
- }
- }
- }
- catch (Exception) { }
- }
- private void clear_trackbox_Click(object sender, EventArgs e)
- {
- track_box.Items.Clear();
- }
- private void open_tracklist_Click(object sender, EventArgs e)
- {
- int index;
- string line;
- if (OpenTXTFileDialog.ShowDialog() == DialogResult.OK)
- {
- //здесь происходит удаление имеющихся записей в listBox1
- if (track_box.Items.Count != 0)
- for (index = track_box.Items.Count - 1; index >= 0; index--)
- track_box.Items.RemoveAt(index);
- string fileName = OpenTXTFileDialog.FileName;
- FileStream sss = File.Open(fileName, FileMode.Open, FileAccess.Read);
- if (sss != null)
- {
- StreamReader reader = new StreamReader(sss);
- while ((line = reader.ReadLine()) != null)
- track_box.Items.Add(line);
- sss.Close();
- }
- }
- }
- private void track_list_btn_Click(object sender, EventArgs e)
- {
- if (this.Height == 780 | this.Height == 505)
- {
- track_box_hide = true;
- }
- else
- {
- track_box_hide = false;
- }
- if (track_box_hide)
- {
- track_box.Visible = false;
- this.Height -= 230;
- video_btn.Top = video_go_back;
- video_btn.Top = track_box.Top + 5;
- video.Top = video_btn.Top + 32;
- }
- if (!track_box_hide)
- {
- track_box.Visible = true;
- this.Height += 400;
- video_btn.Top = 438;
- video.Top = video_btn.Top + 32;
- }
- }
- private void video_btn_Click(object sender, EventArgs e)
- {
- if (this.Height == 780)
- {
- video_hide = true;
- }
- else
- {
- video_hide = false;
- }
- if (video_hide)
- {
- video.Visible = false;
- this.Height -= 275;
- }
- if (!video_hide)
- {
- video.Visible = true;
- this.Height += 275;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement