// Code to execute when the application is deactivated (sent to background) // This code will not execute when the application is closing private void Application_Deactivated(object sender, DeactivatedEventArgs e) { if (this.SesionIniciada) { if (this.loadSaveCliente) { clienteLSP = new ClienteLoadSaveP(); if (clienteLSP.saveClient(this.SessionId, this.cliente, this.dtoLogin)) { System.Diagnostics.Debug.WriteLine("cliente salvado"); } } if (PhoneApplicationService.Current.State.ContainsKey("loadClienteStatus")) PhoneApplicationService.Current.State["loadClienteStatus"] = this.loadSaveCliente; else PhoneApplicationService.Current.State.Add("loadClienteStatus", this.loadSaveCliente); } IsolatedStorageSettings.ApplicationSettings["SesionIniciada"] = this.SesionIniciada; IsolatedStorageSettings.ApplicationSettings["Cuentas"] = this.Cuentas; IsolatedStorageSettings.ApplicationSettings["Tarjetas"] = this.Tarjetas; IsolatedStorageSettings.ApplicationSettings["TotalCuentas"] = this.TotalCuentas; IsolatedStorageSettings.ApplicationSettings["FechaActual"] = this.fechaActual; IsolatedStorageSettings.ApplicationSettings["EstatusToken"] = this.EstatusToken; IsolatedStorageSettings.ApplicationSettings["EstatusSoftToken"] = this.EstatusSoftToken; IsolatedStorageSettings.ApplicationSettings["ZonaToken"] = TokenManager.ZONA; IsolatedStorageSettings.ApplicationSettings["LastOtp"] = TokenManager.lastOtp; IsolatedStorageSettings.ApplicationSettings["cc"] = CookieContainer; IsolatedStorageSettings.ApplicationSettings.Save(); }
// Code to execute when the application is activated (brought to foreground) // This code will not execute when the application is first launched private void Application_Activated(object sender, ActivatedEventArgs e) { if (timer == null) { timer = new System.Threading.Timer((_) => { this.RootFrame.Dispatcher.BeginInvoke(() => { if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() && !this.IsNetworkAvailable) { this.IsNetworkAvailable = false; MessageBox.Show(TextosFront.frontMensajeConexionInternet); } else { this.IsNetworkAvailable = true; } }); }); timer.Change(0, 5000); } serviceRequest = new ServiceRequest2(); Santander.DataAccess.Services.InitializeServices(); Santander.DataAccess.Jsons.InitializeJsons(); Santander.View.Views.InitializeViews(); bool statusLoadCliente = false; bool sesionInit = false; IsolatedStorageSettings.ApplicationSettings.TryGetValue("Cuentas", out this.Cuentas); IsolatedStorageSettings.ApplicationSettings.TryGetValue("Tarjetas", out this.Tarjetas); IsolatedStorageSettings.ApplicationSettings.TryGetValue("TotalCuentas", out this.TotalCuentas); IsolatedStorageSettings.ApplicationSettings.TryGetValue("FechaActual", out this.fechaActual); IsolatedStorageSettings.ApplicationSettings.TryGetValue("EstatusToken", out this.EstatusToken); IsolatedStorageSettings.ApplicationSettings.TryGetValue("EstatusSoftToken", out this.EstatusSoftToken); IsolatedStorageSettings.ApplicationSettings.TryGetValue("ZonaToken", out TokenManager.ZONA); IsolatedStorageSettings.ApplicationSettings.TryGetValue("LastOtp", out TokenManager.lastOtp); if (IsolatedStorageSettings.ApplicationSettings.TryGetValue("SesionIniciada", out sesionInit)) this.SesionIniciada = sesionInit; if (this.SesionIniciada) { if (PhoneApplicationService.Current.State.ContainsKey("loadClienteStatus")) { statusLoadCliente = (bool)PhoneApplicationService.Current.State["loadClienteStatus"]; if (statusLoadCliente) { clienteLSP = new ClienteLoadSaveP(); if (clienteLSP.loadClient()) { System.Diagnostics.Debug.WriteLine("cliente cargado"); this.cliente.getFechaActual(); this.cliente.ClienteLoad = statusLoadCliente; } } this.loadSaveCliente = true; } } this.matrix = Validaciones.cargarCSVResToken(); }