-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathMainWindow.xaml.cs
More file actions
283 lines (219 loc) · 8.75 KB
/
Copy pathMainWindow.xaml.cs
File metadata and controls
283 lines (219 loc) · 8.75 KB
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
using Project_Lightning.Pages;
using Project_Lightning.UserControls;
using Project_Lightning.Windows;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Project_Lightning
{
/// <summary>
/// Lógica de interacción para MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public Canvas NotificationCanvasPublic => NotificationCanvas;
public MainWindow()
{
InitializeComponent();
BackgroundVideo.Play();
string versionLocal = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;
txtVersion.Text = "Version: " + versionLocal + " ";
//versionLocal = "0,0,0,0";
ocultarCabecera();
Cabecera.HomePresionado += boton_home_presionado;
Cabecera.UbisoftPresionado += boton_ubisoft_presionado;
Cabecera.EAPresionado += boton_ea_presionado;
Cabecera.RockstarPresionado += boton_rockstar_presionado;
Cabecera.DenuvoPresionado += boton_denuvo_presionado;
Cabecera.PlayStationPresionado += boton_playstation_presionado;
Cabecera.OthersPresionado += boton_others_presionado;
framePrincipal.Navigating += (s, e) =>
{
//BLOQUEO LA NAVEGACIÓN SI EL MOTIVO ES "MouseButton"
if (e.NavigationMode == NavigationMode.Back || e.NavigationMode == NavigationMode.Forward)
{
e.Cancel = true; //CANCELO la navegación
}
};
//CUANDO LA VENTANA SE CARGUE POR COMPLETO, ABRO LA VENTANA DMCA
this.Loaded += (s, e) =>
{
Dispatcher.BeginInvoke(new Action(() =>
{
string ultimaVersion = Properties.Settings.Default.UltimaVersionConDMCA;
if (ultimaVersion != versionLocal)
{
var DMCA_Window = new DMCA_Window
{
Owner = this,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
DMCA_Window.ShowDialog();
Properties.Settings.Default.UltimaVersionConDMCA = versionLocal;
Properties.Settings.Default.Save();
}
}), System.Windows.Threading.DispatcherPriority.ApplicationIdle); // Espera a que todo esté cargado
};
}
//METODO PARA UBISOFT
private void boton_home_presionado(object sender, RoutedEventArgs e)
{
framePrincipal.Navigate(new panelMenuPrincipal());
ocultarCabecera();
}
//METODO PARA UBISOFT
private void boton_ubisoft_presionado(object sender, RoutedEventArgs e)
{
framePrincipal.Navigate(new panelApp("UBISOFT", this));
}
//METODO PARA EA
private void boton_ea_presionado(object sender, RoutedEventArgs e)
{
framePrincipal.Navigate(new panelApp("EA", this));
}
//METODO PARA ROCKSTAR
private void boton_rockstar_presionado(object sender, RoutedEventArgs e)
{
framePrincipal.Navigate(new panelApp("ROCKSTAR", this));
}
//METODO PARA DENUVO
private void boton_denuvo_presionado(object sender, RoutedEventArgs e)
{
framePrincipal.Navigate(new panelApp("DENUVO", this));
}
//METODO PARA PLAY STATION
private void boton_playstation_presionado(object sender, RoutedEventArgs e)
{
framePrincipal.Navigate(new panelApp("PlayStation", this));
}
//METODO PARA OTHERS
private void boton_others_presionado(object sender, RoutedEventArgs e)
{
framePrincipal.Navigate(new panelApp("OTHERS", this));
}
private void BackgroundVideo_MediaFailed(object sender, ExceptionRoutedEventArgs e)
{
MessageBox.Show("Error al cargar el video: " + e.ErrorException.Message);
}
private void BackgroundVideo_MediaEnded(object sender, RoutedEventArgs e)
{
try
{
// Reinicia el video al principio
BackgroundVideo.Position = TimeSpan.Zero;
BackgroundVideo.Play();
}
catch (Exception ex)
{
// Manejo de excepciones para evitar que la app se cierre
MessageBox.Show("Error al reiniciar el video: " + ex.Message);
}
}
//METODO PARA RESTAURAR LA CABECERA
public void ocultarCabecera()
{
//Cabecera.Height = 0;
Cabecera.Visibility = Visibility.Collapsed;
}
//METODO PARA OCULTAR LA CABECERA
public void mostrarCabecera()
{
//Cabecera.Height = 70;
Cabecera.Visibility = Visibility.Visible;
}
//PARA EL SLIDEBAR
public class ExpandTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double width = (double)value;
return width > 100 ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
//EVENTOS PARA LOS BOTONES DEL SLIDEBAR
//EVENTO PARA EL BOTON DE LA BIBLIOTECA
private void BibliotecaButtonClick(object sender, RoutedEventArgs e)
{
var ventanaPrincipal = Application.Current.MainWindow as MainWindow;
if (ventanaPrincipal != null)
{
//CAMBIAR EL CONTENIDO DEL FRAME
ventanaPrincipal.framePrincipal.Navigate(new panelBiblioteca(ventanaPrincipal));
ocultarCabecera();
}
}
//EVENTO PARA EL BOTON DE LA TIENDA
private void TiendaButtonClick(object sender, RoutedEventArgs e)
{
var ventanaPrincipal = Application.Current.MainWindow as MainWindow;
if (ventanaPrincipal != null)
{
//CAMBIAR EL CONTENIDO DEL FRAME
ventanaPrincipal.framePrincipal.Navigate(new panelTienda(ventanaPrincipal));
ocultarCabecera();
}
}
//EVENTO PARA EL BOTON DE BYPASS
private void bypassButtonClick(object sender, RoutedEventArgs e)
{
var ventanaPrincipal = Application.Current.MainWindow as MainWindow;
if (ventanaPrincipal != null)
{
//CAMBIAR EL CONTENIDO DEL FRAME
ventanaPrincipal.framePrincipal.Navigate(new panelBypass(ventanaPrincipal));
ocultarCabecera();
}
}
//EVENTO PARA EL BOTON DE ONLINEFIX
private void onlineFixButtonClick(object sender, RoutedEventArgs e)
{
var ventanaPrincipal = Application.Current.MainWindow as MainWindow;
if (ventanaPrincipal != null)
{
//CAMBIAR EL CONTENIDO DEL FRAME
ventanaPrincipal.framePrincipal.Navigate(new panelOnlineFix(ventanaPrincipal));
ocultarCabecera();
}
}
//EVENTO PARA EL BOTON DE STEAMLESS
private void steamlessButtonClick(object sender, RoutedEventArgs e)
{
var ventanaPrincipal = Application.Current.MainWindow as MainWindow;
if (ventanaPrincipal != null)
{
//CAMBIAR EL CONTENIDO DEL FRAME
ventanaPrincipal.framePrincipal.Navigate(new panelSteamLess(ventanaPrincipal));
ocultarCabecera();
}
}
//EVENTO PARA EL BOTON DE AJUSTES
private void AjustesButtonClick(object sender, RoutedEventArgs e)
{
var ventanaPrincipal = Application.Current.MainWindow as MainWindow;
if (ventanaPrincipal != null)
{
//CAMBIAR EL CONTENIDO DEL FRAME
ventanaPrincipal.framePrincipal.Navigate(new panelAjustes(ventanaPrincipal));
ocultarCabecera();
}
}
}
}