-
Notifications
You must be signed in to change notification settings - Fork 0
/
FrmPronosticos.cs
189 lines (168 loc) · 7 KB
/
FrmPronosticos.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
using DemoWebService.WebServiceIMN;
using System;
using System.Drawing;
using System.Windows.Forms;
namespace DemoWebService
{
public partial class FrmPronosticos : Form
{
public FrmPronosticos()
{
InitializeComponent();
this.CenterToScreen();
}
private void FrmPronostico_Load(object sender, EventArgs e)
{
CargarEfemerides();
CargarRegiones();
groupBox1.Visible = false;
groupBox2.Visible = false;
groupBox3.Visible = false;
}
private void CargarRegiones()
{
WSMeteorologicoClient ws = new WSMeteorologicoClient("WSMeteorologico");
PRONOSTICO_REGIONAL reg = ws.pronosticoRegional(new pronosticoRegion()).ParseXML<PRONOSTICO_REGIONAL>();
boxRegiones.DataSource = reg.REGIONES;
}
private void CargarEfemerides()
{
WSMeteorologicoClient ws = new WSMeteorologicoClient("WSMeteorologico");
EFEMERIDES ef = ws.efemerides(new efemerides()).ParseXML<EFEMERIDES>();
lblSolSale.Text = String.Format("Sale: {0}", Convert.ToDateTime(ef.EFEMERIDE_SOL.SALE).ToString("hh:mm tt"));
lblSolPone.Text = String.Format("Pone: {0}", Convert.ToDateTime(ef.EFEMERIDE_SOL.SEPONE).ToString("hh:mm tt"));
lblLunaSale.Text = String.Format("Sale: {0}", Convert.ToDateTime(ef.EFEMERIDE_LUNA.SALE).ToString("hh:mm tt"));
if (!ef.EFEMERIDE_LUNA.SEPONE.Equals("null"))
{
lblLunaPone.Text = String.Format("Pone: {0}", Convert.ToDateTime(ef.EFEMERIDE_LUNA.SEPONE).ToString("hh:mm tt"));
}
lblFaseLunar.Text = ef.FASELUNAR.Value;
}
private void SeleccionRegion(object sender, EventArgs e)
{
WSMeteorologicoClient ws = new WSMeteorologicoClient("WSMeteorologico");
if (boxRegiones.SelectedIndex >= 0)
{
int id = (boxRegiones.SelectedItem as PRONOSTICO_REGIONALREGION)?.idRegion ?? -1;
if (id != -1)
{
pnlMañanaR.Hide();
pnlTardeR.Hide();
pnlNocheR.Hide();
PRONOSTICO_REGIONAL reg = ws.pronosticoRegionalxID(id).ParseXML<PRONOSTICO_REGIONAL>();
if (reg.REGIONES[0].ESTADOMANANA != null)
{
pbxImagenM.ImageLocation = String.Format("https://www.imn.ac.cr{0}", reg.REGIONES[0].ESTADOMANANA.imgPath);
lblComentarioM.Text = reg.REGIONES[0].COMENTARIOMANANA;
lblTituloM.Text = reg.REGIONES[0].ESTADOMANANA.Value;
pnlMañanaR.Show();
}
if (reg.REGIONES[0].ESTADOTARDE != null)
{
pbxImagenT.ImageLocation = String.Format("https://www.imn.ac.cr{0}", reg.REGIONES[0].ESTADOTARDE.imgPath);
lblComentarioT.Text = reg.REGIONES[0].COMENTARIOTARDE;
lblTituloT.Text = reg.REGIONES[0].ESTADOTARDE.Value;
pnlTardeR.Show();
}
if (reg.REGIONES[0].ESTADONOCHE != null)
{
pbxImagenN.ImageLocation = String.Format("https://www.imn.ac.cr{0}", reg.REGIONES[0].ESTADONOCHE.imgPath);
lblComentarioN.Text = reg.REGIONES[0].COMENTARIONOCHE;
lblTituloN.Text = reg.REGIONES[0].ESTADONOCHE.Value;
pnlNocheR.Show();
}
CargarCiudades(reg.REGIONES[0].CIUDADES);
}
}
}
private void CargarCiudades(PRONOSTICO_REGIONALREGIONCIUDAD[] ciudades)
{
boxCiudad.DataSource = ciudades;
}
private void SeleccionCiudad(object sender, EventArgs e)
{
PRONOSTICO_REGIONALREGIONCIUDAD ciudad = boxCiudad.SelectedItem as PRONOSTICO_REGIONALREGIONCIUDAD;
pnlMañanaC.Hide();
pnlTardeC.Hide();
pnlNocheC.Hide();
if (ciudad.ESTADOMANANA != null) {
pbxCM.ImageLocation = String.Format("https://www.imn.ac.cr{0}", ciudad.ESTADOMANANA.imgPath);
lblCCM.Text = ciudad.COMENTARIOMANANA;
lblCTM.Text = ciudad.ESTADOMANANA.Value;
pnlMañanaC.Show();
}
if (ciudad.ESTADOTARDE != null)
{
pbxCT.ImageLocation = String.Format("https://www.imn.ac.cr{0}", ciudad.ESTADOTARDE.imgPath);
lblCCT.Text = ciudad.COMENTARIOTARDE;
lblCTT.Text = ciudad.ESTADOTARDE.Value;
pnlTardeC.Show();
}
if (ciudad.ESTADONOCHE != null)
{
pbxCN.ImageLocation = String.Format("https://www.imn.ac.cr{0}", ciudad.ESTADONOCHE.imgPath);
lblCCN.Text = ciudad.COMENTARIONOCHE;
lblCTN.Text = ciudad.ESTADONOCHE.Value;
pnlNocheC.Show();
}
}
private void btnSalir_Click(object sender, EventArgs e)
{
DialogResult opcion;
opcion = MessageBox.Show("Desea Salir", "Salir", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (opcion == DialogResult.Yes)
{
Application.Exit();
Close();
}
}
private void boxEfeSol_CheckedChanged(object sender, EventArgs e)
{
if (boxEfeSol.Checked)
{
groupBox1.Visible = true;
this.Size = new Size(797, this.Size.Height);
}
if (!boxEfeSol.Checked)
{
groupBox1.Visible = false;
if (!boxEfeLuna.Checked && !boxFaseLunar.Checked)
{
this.Size = new Size(629, this.Size.Height);
}
}
}
private void boxEfeLuna_CheckedChanged(object sender, EventArgs e)
{
if (boxEfeLuna.Checked)
{
groupBox2.Visible = true;
this.Size = new Size(797, this.Size.Height);
}
if (!boxEfeLuna.Checked)
{
groupBox2.Visible = false;
if (!boxFaseLunar.Checked && !boxEfeSol.Checked)
{
this.Size = new Size(629, this.Size.Height);
}
}
}
private void boxFaseLunar_CheckedChanged(object sender, EventArgs e)
{
if (boxFaseLunar.Checked)
{
groupBox3.Visible = true;
this.Size = new Size(797, this.Size.Height);
}
if (!boxFaseLunar.Checked)
{
groupBox3.Visible = false;
if(!boxEfeLuna.Checked && !boxEfeSol.Checked)
{
this.Size = new Size(629, this.Size.Height);
}
}
}
}
}