Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- using System.Windows.Forms;
- using System.IO;
- namespace Homeroom_Brodcast_Custom_Player
- {
- public partial class Form1 : Form
- {
- string file = Path.Combine(AppDomain.CurrentDomain
- .BaseDirectory, "Data\\Brodcast.avi");
- string dataPath = Path.Combine(AppDomain.CurrentDomain
- .BaseDirectory, "Data\\");
- public Form1()
- {
- InitializeComponent();
- openFileDialog1.InitialDirectory = dataPath;
- axWindowsMediaPlayer1.BringToFront();
- //AppDomain.CurrentDomain.BaseDirectory;
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- //(Full Name) Jolt Imagination Live Loader
- if (!File.Exists(file) && !BrowseFile())
- {
- Application.Exit();
- return;
- }
- axWindowsMediaPlayer1.URL = file;
- Cursor.Hide();
- FormBorderStyle = FormBorderStyle.None;
- WindowState = FormWindowState.Maximized;
- }
- private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
- {
- if (e.newState == 8)
- {
- pictureBox1.Image = Homeroom_Brodcast_Custom_Player.Properties.Resources.main_jpeg;
- pictureBox1.BringToFront();
- pictureBox1.Width = Screen.PrimaryScreen.Bounds.Width;
- pictureBox1.Height = Screen.PrimaryScreen.Bounds.Height;
- }
- }
- public bool BrowseFile()
- {
- DialogResult dialogResult = openFileDialog1.ShowDialog();
- if (dialogResult == DialogResult.OK)
- {
- file = openFileDialog1.FileName;
- return true;
- }
- else return false;
- }
- private void axWindowsMediaPlayer1_KeyPressEvent(object sender, AxWMPLib._WMPOCXEvents_KeyPressEvent e)
- {
- if (e.nKeyAscii == 27) this.Close();
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- Console.WriteLine(DateTime.Now.ToLongTimeString());
- if (DateTime.Now.ToLongTimeString() == "10:20:00 AM")
- {
- doRepeat();
- }
- else if (DateTime.Now.ToLongTimeString() == "10:55:00 AM")
- {
- doRepeat();
- }
- else if (DateTime.Now.ToLongTimeString() == "11:10:00 AM")
- {
- doRepeat();
- }
- else if (DateTime.Now.ToLongTimeString() == "11:45:00 AM")
- {
- doRepeat();
- }
- else if (DateTime.Now.ToLongTimeString() == "12:00:00 PM")
- {
- doRepeat();
- }
- else if (DateTime.Now.ToLongTimeString() == "12:35:00 PM")
- {
- doRepeat();
- }
- else if (DateTime.Now.ToLongTimeString() == "12:45:00 PM")
- {
- Cursor.Show();
- timer1.Enabled = false;
- DialogResult dialogResult = MessageBox.Show("All homerooms are over. Would you like to exit the program?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
- if (dialogResult == DialogResult.Yes)
- {
- this.Close();
- }
- }
- }
- private void doRepeat()
- {
- Console.WriteLine("Play");
- axWindowsMediaPlayer1.BringToFront();
- axWindowsMediaPlayer1.Ctlcontrols.currentPosition = 0;
- axWindowsMediaPlayer1.Ctlcontrols.play();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement