-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmPrincipal.cs
150 lines (129 loc) · 4.39 KB
/
frmPrincipal.cs
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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.Xml.Linq;
using System.Diagnostics;
namespace Calebe2024
{
public partial class frmPrincipal : Form
{
frmMusic frm;
string[] Music = new string[11];
string[] URL = new string[11];
public frmPrincipal()
{
InitializeComponent();
CarregarMusicasDoXML(@"C:\Program Files\Missão Calebe 2024\musics.xml");
}
private void CarregarMusicasDoXML(string caminhoXML)
{
try
{
XDocument doc = XDocument.Load(caminhoXML);
try
{
for (int i = 0; i <= 10; i++)
{
// Use ElementAt(i) para acessar o elemento específico no índice i
XElement elementoMusica = doc.Descendants("musica").ElementAt(i);
string titulo = elementoMusica.Element("titulo").Value;
string caminho = elementoMusica.Element("caminho").Value;
Music[i] = titulo;
URL[i] = caminho;
}
}
catch (Exception ex)
{
MessageBox.Show("Erro ao carregar as músicas: " + ex.Message, "Missão Calebe 2024", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (Exception ex)
{
MessageBox.Show("Erro ao carregar lista de músicas: " + ex.Message, "Missão Calebe 2024", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void frmPrincipal_Load(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Maximized;
}
private void frmPrincipal_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == Convert.ToChar(Keys.Escape))
{
Application.Exit();
}
}
private void lblMaranata_Click(object sender, EventArgs e)
{
frm = new frmMusic(Music[0], URL[0]);
frm.ShowDialog();
}
private void lblEuSouCalebe_Click(object sender, EventArgs e)
{
frm = new frmMusic(Music[1], URL[1]);
frm.ShowDialog();
}
private void lblMaravilhas_Click(object sender, EventArgs e)
{
frm = new frmMusic(Music[2], URL[2]);
frm.ShowDialog();
}
private void lblEntrega_Click(object sender, EventArgs e)
{
frm = new frmMusic(Music[5], URL[5]);
frm.ShowDialog();
}
private void lblOPoderDoAmor_Click(object sender, EventArgs e)
{
frm = new frmMusic(Music[3], URL[3]);
frm.ShowDialog();
}
private void lblTomaOMeuCoracao_Click(object sender, EventArgs e)
{
frm = new frmMusic(Music[4], URL[4]);
frm.ShowDialog();
}
private void lblMeuFarol_Click(object sender, EventArgs e)
{
frm = new frmMusic(Music[6], URL[6]);
frm.ShowDialog();
}
private void lblSomosTeus_Click(object sender, EventArgs e)
{
frm = new frmMusic(Music[7], URL[7]);
frm.ShowDialog();
}
private void lblOracao_Click(object sender, EventArgs e)
{
frm = new frmMusic(Music[8], URL[8]);
frm.ShowDialog();
}
private void lblSorteio_Click(object sender, EventArgs e)
{
frm = new frmMusic(Music[9], URL[9]);
frm.ShowDialog();
}
private void lblApelo_Click(object sender, EventArgs e)
{
frm = new frmMusic(Music[10], URL[10]);
frm.ShowDialog();
}
private void label1_Click(object sender, EventArgs e)
{
try
{
Process.Start("https://thiagosousa81.wordpress.com/");
}
catch (Exception)
{
throw;
}
}
}
}