aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications/mp3Player.cs
blob: c4afd0de2cf429693ba72acffe7826ea7b886d1b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ShiftOS.Engine
{
    [Launcher("WAV Player", true, "wav_player_al")]
    [RequiresUpgrade("wav_player")]
    [WinOpen("wav_player")]
    public partial class UserControl1 : UserControl, IShiftOSWindow
    {
        string path;
        public UserControl1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "WAV|*.wav";

            if(ofd.ShowDialog() == DialogResult.OK)
            {
                path = ofd.FileName;
                mp3FilePath.Text = ofd.FileName;
            }
        }

        private void stopMp3_Click(object sender, EventArgs e)
        {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.Stop();
        }

        public void OnLoad()
        {
        }

        public void OnSkinLoad()
        {
        }

        public bool OnUnload()
        {
            return true;
        }

        public void OnUpgrade()
        {
        }

        private void button2_Click(object sender, EventArgs e)
        {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = path;
            player.Load();
            player.Play();
        }
    }
}